Drag and Drop - detecting drop away from a component

Flex 4, AIR 2.0 app
I have a drag and drop detecting a Button drag away from a Group1 into Group2.
When the user drops into a Group2, the Button is added to it, which obviously removes it from Group1.
I would like it that if the user drags away from Group2 and drops it randomly on the screen, the Button will be added back into Group1.
Does anyone have any ideas as to how I might go about detecting the end of a drag when not over a component, so I can add the button back into Group1 again?
Hope that makes sense!!!

Thanks Ronnie,
I'll have a look at gthis as it looks a bit more efficient than the solution I have come up with.
The only thing I'm not sure about is at what point my Button gets put back into Group1.  In my current movie, I have a function which handles the dragDrop event.  But if I drop outside a component, I don't have an event from which I call the handleDrop(dragEvent) function.
I'll have a look.
In the meantime, what I'm doing is Making my drag item a custom component, passing a reference to it's default container (Group1) and its Default X and Y co-ordinates.
Then, I have a dragComplete handler which is called whenever the drag item is released - I then check the action property of the event and if it is "none" I know it has been dropped outside a recognised target and I can add it back into its default group and set its default x and y coordinates.  This seems to work quite nicely at the moment.
so, my code in the Drag Button looks like this:
<?xml version="1.0" encoding="utf-8"?>
<s:Button xmlns:fx="http://ns.adobe.com/mxml/2009"
    xmlns:s="library://ns.adobe.com/flex/spark"
    xmlns:mx="library://ns.adobe.com/flex/mx"
    mouseDown="mouseDownHandler(event)"
    dragComplete="dragCompleteHandler(event)">
<fx:Script>
  <![CDATA[  
   import mx.core.DragSource;
   import mx.core.IUIComponent;
   import mx.events.DragEvent;
   import mx.managers.DragManager;
   public var _defaultParent:Object;
   public var _defaultX:Number;
   public var _defaultY:Number;
   protected function mouseDownHandler(event:MouseEvent):void
    // the drag initiator is the object being dragged (target of the mouse event)
    var dragInitiator:IUIComponent = event.currentTarget as IUIComponent;
    // the drag source contains data about what's being dragged
    var dragSource:DragSource = new DragSource();
    // ask the DragManger to begin the drag
    DragManager.doDrag( dragInitiator, dragSource, event, null );
   protected function dragCompleteHandler(event:DragEvent):void
    // TODO Auto-generated method stub
    //trace("Drag complete!");
    //trace("target = " + event.target);
    //trace("action = " + event.action);
    if (event.action != "none"){
     trace("woo!");
    }else{
     trace("put the drag label back into its original position");
     if (event.target.parent != _defaultParent){
      trace("put it back, you monster!");
      _defaultParent.addElement(event.target);
      event.target.x = _defaultX;
      event.target.y = _defaultY;
     }else{
      trace("ah... it's already in the right place... actually!");
  ]]>
</fx:Script>
</s:Button>

Similar Messages

  • Why do some of the songs on iTunes not transfer to my iPhone when I drag and attempt to drop them?

    Why do some of the songs on iTunes not transfer to my iPhone when I drag and attempt to drop them?

    No one hear has any idea why you are having a problem without a lot more information. Have you checked Sync only checked songs? Have you checked "Manually manage music and videos"? Are ANY songs transferrring, or None? Are all of the songs purchased with the same iTunes account? ARE they purchased iTunes songs or from another source? Are you using the same computer all the time (the iPhone can sync music from only one computer at a time)?

  • I want to access my library on my macbook pro and copy work done away from home from my imac how do I do this?

    I want to access my library on my macbook pro and copy work done away from home to Aperture on my imac how do I do this?

    Are you working on images on both machines?
    If you want to round-trip images, you can export a project as a library from your iMac, copy that to your MacBook Pro, and then edit the images there.  When you're done, copy that library back to the iMac and import it to your iMac.  The iMac should recognize the changes you've made and update its images.
    Read the Aperture help file, which will guide you to the Aperture manual.  It can walk you through this.  You have to be careful to do it correctly, but I've done this a few times and it works quite well.

  • I am only able to receive e-mails at home and cannot receive them away from home

    I am only able to receive e-mails at home and cannot receive them away from home.  Not being a technical person some "simple" suggestions would be appreciated.

    How many other places/networks have you tried? Maybe those places you tried are blocking the port/site.
    Have you tried contacting your email providers support site?

  • Global Correlation and Anomaly detection drop messages?

    We've implemented an SSP-40 and were wondering if there were event messages for Global Correlation or Anomaly detection drops.  We seem to only have signature event messages.
    Dennis

    Sure. Here is an example:
    evIdsAlert: eventId=1332748411090083862 severity=informational vendor=Cisco alarmTraits=32768
    originator:
       hostId: sensorName
       appName: sensorApp
       appInstanceId: 19247
    time: 2012/03/27 15:12:41 2012/03/27 15:12:41 UTC
    signature: description=ICMP Echo Request id=2004 created=20001127 type=other version=S592
       subsigId: 0
    interfaceGroup: vs0
    vlan: 1104
    participants:
       attacker:
         addr: locality=OUT A.B.C.3
       target:
         addr: locality=OUT A.B.C.2
         os: idSource=unknown relevance=relevant type=unknown
    actions:
       deniedPacket: true
    riskRatingValue: attackRelevanceRating=relevant targetValueRating=medium 95
    threatRatingValue: 60
    interface: ge2_0
    protocol: icmp
    globalCorrelation:
       globalCorrelationScore: -9.2
       globalCorrelationRiskDelta: 60
       globalCorrelationModifiedRiskRating: true
       globalCorrelationDenyPacket: true
       globalCorrelationDenyAttacker: false
       globalCorrelationOtherOverrides: false
       globalCorrelationAuditMode: false
    Alternatively, you can see the stats using:
    sensor# show  statistics analysis-engine | be Malicious
    MaliciousSiteDenyHitCounts
    A.B.C.D/16 = 1
    MaliciousSiteDenyHitCountsAUDIT
    Regards,
    Sawan Gupta

  • Detecting navigation away from a screen

    To play mp3 files in my web application, I've a  simple audio player with play/pause buttons, progress bar, etc. Just the way  VideoPlayer stops playing video when user of the application switches to some  other screen, I would like my audio player to stop playing audio when the user  switches to some other screen. What event can I use to detect that the audio  player (s:VGroup) isn't 'visible'?
    Although this question is framed around stopping an  audio player, the same applies to a situation where user is navigating away from  a form without saving modified data.
    Thanks,
    Dilip

    Hey Dilip,
    You need to include Javascript here. What you need to do is put an event on window.blur and on window.blur call a code of Flex application to make the audio player mute.
    I think that make sense to you still if you have any question let me know.
    Thanks & Regards
    Ankur Arora
    Project Leader(Flash and Flex)
    http://flashdeveloper.blogspot.com
    http://www.ankur-arora.com

  • Need to have the keyboard and mouse 100 feet away from Mac

    I need to have the Keyboard and Mouse/Track-pad 100 feet away from Mac Mini.
    What are my options ?
    Thanks

    In your case with the need to control it from multiple locations the best and realistically only solution is to use Screen Sharing to remotely control the Mac.
    With this solution you can control it from anywhere you have a network connection and could use a laptop to control the Mac mini. This is the solution I use in a very similar situation.
    Bluetooth does not have enough range, even RF wireless keyboard and mice devices also would not have the range, and I don't believe there is a suitable USB solution.
    The only other possibility that occurs to me is to use an IP based KVM. A KVM (Keyboard/Video/Mouse) switch box allows multiple computers to be controlled from typically a single keyboard and mouse. However there are versions which allows you to do this over a TCP/IP network i.e. Ethernet. Then again you would be able to do this anywhere on your network. Here is one example - http://www.aten-usa.com/products/productItem.php?model_no=CN8600
    Personally I still strongly recommend using Screen Sharing. Its built-in and completely free!

  • [SOLVED] WINE and NVIDIA issues - scrolling away from fullscreen

    Hello again... more problems from me.
    I seem to have a problem with my WINE running fullscreen applications, such as games. When I start, say, a fullscreen game, it does start in fullscreen, but if I move my mouse to the right or bottom edge of the screen, the game screen "scrolls away", and I'm shown my desktop (at a lower resolution). When I pull my mouse/touchpad back to the left or upper edge, the screen returns.
    I'd love to post screenshots of this, but those show nothing useful
    (which leads me to a suspicion there might me something wrong with my display configuration - but this is only a suspicion.)
    It happens regardless of Compiz or any other window manager, and regardless of the "Graphics" settings in winecfg. This is only the case with WINE; I've tried some native fullscreen games, which work flawlessly.
    This is really annoying, as it renders most of the games unplayable.
    I have an NVIDIA GeForce 9600M GT graphics card, and am running the 64-bit Arch Linux. Here's my xorg.conf and my Xorg.0.log.
    I'd be very grateful if someone could help me with this. Thanks!
    Last edited by Wintershade (2009-08-20 19:58:14)

    there was also a workaround I came to, but it was a messy one compared to this. the idea was to make a batch script for every game I would install, which would first call the xrandr <resolution>, then wine the game, and after that xrandr back to my desktop resolution. needless to say I had this as a last resort, since this would mess up changing the ingame resolution, and don't even get me started about the mess it makes on the desktop

  • New iPads for my kids.  Best way to share certain apps, iBooks, music, and to keep them away from inappropriate content.

    We purchased ipad minis for my two kids this Christmas (ages 6 &amp; 8).  I have been working on setting them up so they are ready to use.  I created gmail accounts and Apple ID accounts to use for messaging and FaceTime only.  I put restrictions so they can not use email, Facebook, Twitter, Safari, etc.  I plan on using a kid friendly browsing such as Mobicip.  The part I am getting hung up is being able to put certain things on their iPads from my wife's iTunes account.  We have decided to use her account to sync with their new iPads.  Obviously, the kids will not have access to her password on iTunes.  She has very few game apps on her ipad.  I would like to add fun appropriate kid games to her iTunes account to sync to their iPads, but not my wife's.  The same thing with iBooks and music.  Some of my wife's books are not kid appropriate.  I know you can create playlists to share music.  What is the best way to go about setting up iTunes?  Any other things I am forgetting to keep inappropriate material from curious kids.
    Thanks.

    I don't want her to authorize to my iTunes account.  I set up a separate one for her.
    You'll have to authorize her system to your iTunes Store account if there is content other than music that you want her to still have. Movies, app, etc. are locked to the account through which they were purchased, so if there is any such content she wants, you'll either have to authorize to your iTunes account or she'll have to repurchase that content. Please note that authorizing her computer to your account will not allow her to purchase new content through your account.
    If there's nothing but music in iTunes Plus format that you plan to give her, then the issue of authorization doesn't apply.
    Regards.

  • Please move the 'SEND' and 'SPELL CHECK' options away from each other, and when sending, ask the question, 'Are you sure you want to send now?' Thanks

    The send and spell check options are next to each other. I can not tell you how many times I hit the send button be accident. When sending, and question of 'Are you sure you want to send now?', should be asked.
    Thanks

    Actually, unless something has changed, you can set Thunderbird to run an automatic spell check when you click Send. That might be your best workaround.
    Tools menu > Options > Composition panel > Spelling mini-tab
    (You can display the classic menu bar by tapping the Alt key)
    It might also be possible to customize the toolbar, but I think this might be safer.
    Regarding a general confirmation for sending, I noticed some add-ons for that, but I don't have any personal recommendations.

  • I would also like to know, what program could I use to take a song and take the instrumental away from the singing. I would like to know wat prgram is similar to audacity for mac.

    I would like to know about a program for mac book similar to Audacity. Pleases assist...

    http://audacity.sourceforge.net/.
    Open source for Mac - latest release should work with any machine/OS.
    Clinton

  • Help with this ... using drag and drop

    Hi guys,
    I'm an intermediate user of Flash, but I'm stuck ... I'm
    trying to see if I can recreate this page in Flash for a friend
    (it's an awful site!):
    Mannequin
    There are two ways I thought I could do this ... as they've
    done it, you cycle through the items, click on an item and it will
    appear in a hierarchy on the mannequin ... or as I've tried to
    attempt it, by dragging the item onto the mannequin.
    This is EXTREMELY rough as I just wanted to see if it could
    be done before designing it all, so it's stick men I'm afraid! I've
    got two movieclips on the stage, one is the console and one is the
    mannequin. The console contains items of clothing which are each
    movieclips placed in their own frame, back and forward buttons and
    an add button (ignore that button).
    I've managed to set it up so that the item of clothing
    duplicates and you can drag it onto the mannequin. I have two
    problems ... the mannequin goes back to normal when I go through
    the items in the console and the items in the console appear on top
    of each other as you flick through (probably because of the
    duplicatemovie command).
    I want to be able to drag each item, establish a hierarchy on
    the mannequin (e.g. so a jacket will go over a top) ... I've
    searched this forum for drag and drop info and have seen references
    to specifying a target, but I'm stuck. I've got a feeling I'm on
    the right lines, but I've either laid it out wrong on the stage or
    I'm missing a vital piece of actionscript ... Please can anyone
    advise??? Thanks
    Test Mannequin
    Flash File

    Hi,
    It would help if you could give some more details:
    - what are you trying to do (drag and drop a whole component, drag an item within a tree, or a table, drag an item from one component to another?)
    - have you found the modules you need in the unbound modules?
    - have you read the documentation about the drag and drop actions? can you say which parts you're having problems with? The documentation is here. You'll have to select the component you are interested in and locate the action "drag" and the action "drop" to read about the parameters required.
    Best regards,
    Alex

  • Recently a software update 7.1 presented itself on my phone. Since attempting to download it, I have lost the ability to search the internet while away from my computer. As well I can't call an one. And they can't call me. The 7.1 update keeps popping up.

    Since attempting to download the latest update of 7.1. the download confirmation showed a pop up saying; unable to install. Can't re attempt to install. Lost internet ability when away from computer and I can't be called, nor can I call anyone. Please, can anyone help me with this? I'll even go back to what I had, had before attempting the 7.1 download.

    Sounds like your only able to use Wifi on your device currently which indicates you have lost network connection with your cellular provider ....you can call them to troubleshoot this but one common issue in some countries is that if you are on a 3G only network this can become turned off after a software update...go to settings > cellular/mobile > and see if enable 3G  or enable 4G/LTE is off or on try turning it on and then power off phone and on again and this will probably fix it, so you can make calls etc and use the internet away from the computer.  As for the update always do an itunes backup first and they make sure you have long enough for this update to run through on wifi and then try it again.  Good Luck

  • How do i download video from iphone 4 to a Mac Compatible Seagate GoFlex external hard drive, drag and drop loads an icon without any data?

    I took some video over christmas using my iphone 4 and ever since i have been trying to back up these videos for safe keeping.  When i tried to back up to my computer's c drive only the smallest file would load, the other 2 the icon would appear but no data was present in properties.  so i then tried to drag and drop to my seagate 3tb GoFlex hard drive and i would also get icons but no data.  It seems to me this would be a simple process anyone know the answer? I have windows xp and can seem to move everything else around without any problem just seems to be video as the problem?

    William G 42 wrote:
    , I just can't really do anything with the content going either way.
    Make sure the EHD is Formatted Mac OS Extended (journaled
    Format, Erase, or Reformat a drive
    In iPhoto, Select All the Photos you want to move... Then Goto... > File > Export >
    Choose the settings as seen here
    Click Export and select your External Drive
    Best to create a Folder to put them in... and away you go...
    More Help available from iPhoto Toolbar Help Menu

  • I can't drag and drop from a data CD I recorded

    I recently burned some audiobooks files (in mp3 format) as data cd's in Toast 8.0.1. When I go to reload them back onto my 20" 2 Ghz Dual Core Intel I can't drag and drop the files directly into any folder while using the columns view in a finder window. I can do it if I drag onto the music folder and let it spring open down to the level of the folder. I also can drag the mp3's into iTunes and then into the folder. This is not CD related since I used several diff brands.
    I constantly update, backup, repair permissions, and do other maintenance so everything is up to date. I have noticed this behavior just since I started to use the program called Audiobook Builder. I am (and have always used) a non-admin user account. When this started a few months ago it seemed to go away with a restart, permission repair, or a logout but now it seems permanant. I checked user permissions on my home folder - I have not added any software since adding Audiobook Builder. Any idea's? I read something about trashing a com.apple pref but didn't try that.
    I suspect Audiobook Builder since it changes the permissions and filetype to the iTunes Audiobook filetype but have not seen anyone reference this.
    wes

    dj_paige wrote:
    While the programming of course could be done, the idea of a function that performs on original unprocessed images seems to violate the whole idea of what Lightroom was designed to be. At least that's my opinion. Of course, the idea that Adobe should do this programming for a relatively small number of people (you're one of a very few people to ask for this, that I have read) seems to be something that isn't going to happen.
    I agree, I can't see much reason for drag-and-drop to drag the unprocessed image - in other words, an image that isn't the one that you see when you drag and drop.  I can see that just filling this forum with "why the heck does it do that????????" posts.  I could be wrong, but I suspect that Adobe won't do that. 
    But if you do want to drag-and-drop the original unprocessed image, you can do it very easily now.  Right click the image, choose "show in Explorer", and then drag-and-drop from Explorer. 

Maybe you are looking for

  • IPhoto: No option to edit in external editor

    I'm running iPhoto 08 under Mavericks on my MacBook Pro. The option to open photos in an external editor is grayed out when I right click on a thumbnail in the main window. In another post I read that in order to do this you first had to select the e

  • Profit centre not displyed in Customer balance

    Hi while executing the FL5N Customer line items the profit centre filed is blank.The profit cenre column is there but not displayed. profit centres Please what to do if we want to diplay Regards Arjun

  • How to reimplement the handleUnload javascript method ?

    Hi all, we are facing an issue here with a generated BPS application(using BPS_WB) which is integrated in another BSP application (cProjects). In fact, often, users are clicking on another tab in cProjects, and they are losing the data they were crea

  • Clearing for customers

    Hi we are working on automatic customer clearance but facing some difficulties. In OB74 what criteria i should define for clearing customers automatically. I have tried using Assignment number but that doesnot work for me. please guide.

  • Will ichat with mac os x 10.5.8. talk for free to window 7 skype

    will ichat with mac os x 10.5.8. talk for free to windows 7 with skype and will it work?