Really simple drag and drop example?

I have just began exploring Adobe AIR and have succesfully
managed to load images into an image component, through drag and
drop from the desktop.
Now I am trying to understand how to do the reverse —
how to drag from the image component to the desktop, but after
spending several hours googling I still haven't found an example
that show how to achieve this. Either the samples are outdated,
from the beta period, or to complicated for me to understand.
Could someone please help me by showing how it is done, in
the simplest possible way?
Thanks in advance.

Hi,
You could let Christophe's excellent components do the heavy
lifting for you:
http://coenraets.org/blog/2007/06/air-to-desktop-drag-and-drop-two-simple-utility-classes/
Or here's a good simple app with code that shows you how it's
done:
http://www.wabysabi.com/blog/2008/03/18/air-example-native-drag-n-drop-and-clipboard-integ ration/

Similar Messages

  • Search drag and drop example

    I'm looking for a simple drag and drop example between two JList, what's the good way to do that....

    Try to start www.google.com
    enter "Drag Drop JList" and search i think the second is best:
    http://java.sun.com/docs/books/tutorial/dnd/sheetal.html
    sorry ;-) but you asked for a good way to look for a simple drag and drop example.

  • Simple drag and drop programme. Bug

    Hi.
    I have a simple drag and drop app for learning English. You hear for eg: banana and have to drag that object to a certain area.
    When my little kid plays it she finds bugs - she's my researcher.
    It's hard to explain the bug as its hard to get it but kids can easily. You click on the target object and drag it a little, then quickly reclick it but not drag ie: release the mouse as it goes back to its initial position. You move the mouse away and and the object follows mouse even though you are now not dragging and you can't drop it.
    I know its hard to imagine this but perhaps this is a know bug for drag and drops.
    private function dragHandler(e:MouseEvent)
                e.currentTarget.startDrag();
                xIni = e.currentTarget.x;
                yIni = e.currentTarget.y;
    The you have the following which has an event listener for the mouse up event.
    private function checkDrag(e:MouseEvent)
                e.currentTarget.stopDrag();
                if (this.currentBubble.hitTestObject(this.dragTarget))
                    if (currentBubble && currentBubble == e.currentTarget)
                        currentBubble.visible = false;
                        blnCorrect = true;
                        points = this.points + 10;
                        score.score_txt.text = String(points);
                        correct++;
                        vehiclePosition+=100;
                        TweenLite.to(animation,1,{x:vehiclePosition})
                        trace("CORRECT="+correct);
                        if (correct == 10)
                            endGame();
                            return;
                    bubbles.splice(currentIndexArray,1);//you must specify the parameter 1 ie: remove 1
                    sndChannel=soundCorrect.play();
                    sndChannel.addEventListener(Event.SOUND_COMPLETE, soundCorrectComplete)
                else
                    incorrect++;
                    sndChannel=soundIncorrect.play();
                    sndChannel.addEventListener(Event.SOUND_COMPLETE, soundIncorrectComplete);
                    TweenLite.to(e.currentTarget, 1, {x:xIni, y:yIni, ease:Strong.easeOut, onComplete:onFinishTween});

    So, the code should be like this:
    private function dragHandler(e:MouseEvent):void
         e.currentTarget.startDrag();
         stage.addEventListener(MouseEvent.MOUSE_UP, checkDrag);
         xIni = e.currentTarget.x;
         yIni = e.currentTarget.y;
    private function checkDrag(e:MouseEvent):void
         stopDrag();
         stage.removeEventListener(MouseEvent.MOUSE_UP, checkDrag);
    Also, i suggest you get into habit to ALWAYS declare datatypes, including what functions return - it is good for memory and performance. In your case, :void should be function return datatype.
    In addition, you don't need to stopDrag() on an object - since only a single object can be dragged at a time - just calling stopDrag() is sufficient.

  • Drag and drop examples do not work ?!

    Hi guys,
    i want to add drag and drop functionality to one of my programs
    i tried to run the java examples of this page:
    http://java.sun.com/docs/books/tutorial/uiswing/dnd/intro.html
    but it just does not work ! windows give me the "can't drop" icon when i drag a file in the frame
    do you experience the same problem?
    Thanks in advance

    i tried:
    A Simple Example: Adding DnD to JLabel
    and
    Data Transfer with a Custom Component
    For both of these, i downloaded/compiled/executed the sourcecode ; there was no error. But the drop couldn't be done
    EDIT: in fact i just realised i didn't read the "try this" instructions and i misunderstood what the progs were supposed to do... in fact they work, they just don't do what i thought they would do XD
    sorry..
    EDIT2 I found a package for easy drag and drop operations ( http://iharder.sourceforge.net/current/java/filedrop/ ) so it's useless to answer to this thread any more, tks ^^

  • Drag And Drop Example and Pointers

    Hello,
    Could you please point me to some code samples and URLs regarding the implementation of Drag and Drop in JavaFX?
    (I want to implement a DnD between two TableViews)
    Thx v much

    I have done this and can give you some pointers. First see my bug report http://javafx-jira.kenai.com/browse/RT-14750 and you'll see they are working on Drag and Drop but here is how I did it.
    First of all I attached event listeners to a custom row object provided with a row factory. The next thing I did was to create a DropTarget interface and a Draggable interface and a DragPane class. The drag mirror (DragPane) class is the node which will be dragged around the screen and is appended to the parent of your TableView's (assuming they share the same parent). The difficult part was detecting if I was over the drop target. I achieved that with the following code which is sitting inside the skin of a single control managing both the source and destination tables.
        public void onSourceRowDragged(MouseEvent event,CustomDraggableRow row)
            double sceneX = event.getSceneX();
            double sceneY = event.getSceneY();
            if (dragMirror == null) {
                dragMirror = new DragPane(row);
                // check for AnchorPane
                if (control.getParent().getClass().isAssignableFrom(AnchorPane.class)) {
                    AnchorPane p = (AnchorPane)control.getParent();
                    p.getChildren().add(dragMirror);
            javafx.scene.control.TablePosition p;
            // Locate drop target
            DropTarget nTarget = null;               
            Point2D tmpp = destTableContainer.sceneToLocal(sceneX,sceneY);
            Node overDestNode = destTableView.pickNode(tmpp.getX(),tmpp.getY());
            while(!(overDestNode == null || TableRowSkin.class.isAssignableFrom(overDestNode.getClass()))) {
                overDestNode = overDestNode.getParent();
                if (overDestNode == destTableView) {
                    overDestNode = null;
            if (overDestNode != null) {
                TableRowSkin overSkin = (TableRowSkin)overDestNode;
                nTarget = (DropTarget)overSkin.getBehavior().getControl();
            if (dropTarget != null && dropTarget != nTarget) {
                dropTarget.onDraggableExited(event);
                dropTarget = null;
            if (nTarget != null && nTarget != dropTarget) {
                dropTarget = nTarget;
                dropTarget.onDraggableEntered(event);
        }This code really only works if the parent is a shared AnchorPane but it was the most difficult part of the project. As you can see the DragPane has a pointer back to the source, and when the mouse button is released if there is a dropTarget I notify the drop target that the object has been dropped. Lastly the mirror needs to be cleaned up. This technique is currently very slow, I suspect it is because the mouse events takes a long time to bubble up from the cells to the row object. I have plans of optimizing this by making the Row block mouse events from reaching the cells, but I haven't had time to optimize it yet. I also haven't followed the development teams official recommendation of creating an invisible cell over all of the other cells to capture the event because that solution, while possible, does not sound logical.

  • Drag and Drop Examples?

    Are there any examples out there of an Edge Drag and Drop interaction? I need to create some drag and drop learning interactions in Edge and can't find any good examples.

    So I am at a loss again. I am taking what you made and trying to adapt it to what I need. However whenever I bring in an image instead of using a rectangle the drop part never works. So it works completly fine just as the rectangle but the image now does not. I want the person to drag the image over to the drop area and have it run code once dropped.
    Here is the link to what I have modified so far.
    https://www.dropbox.com/s/lpuv6mdmdi37vya/NewSlide.zip
    I think it may have to do with how it is referenced but not sure and could use some help.

  • WHY can't this be a simple drag and drop????

    Why why why Apple?? My old computer died, so I put all my iTunes music on my external hard drive. Now I have copied all 5000 songs into my new laptop's Itunes Music folder. Easy enough, right? WHY WON"T ITUNES FIND THESE SONGS?? They are all there. Itunes is looking to that library for music but it won't see them. I have authorized this computer.
    WHY? WHY ISN"T THIS SIMPLE??
    I hate to say HELP because I think I did everything right. Aargh. Help.

    When you moved stuff to the external drive and back to the laptop, did you move the entire iTunes folder, which would have included the iTunes Library file as well as the folder full of music? If you only moved the music and the iTunes Library file as been lost, you will need to reimport the music. You will have lost playcounts, playlists, last played, ratings. If on the other hand, you did move the whole folder, you should be able to get iTunes to be able to see it again by holding down the Shift key while launching iTunes. It will ask you to select a library. Direct it to the one on your laptop.
    It is as simple as drag and drop as long as you drag and drop the right things.
    Best of luck.

  • Adobe Flex 4 Drag and drop example in application

    I have been looking at the following example:
    http://help.adobe.com/en_US/flex/using/WS2db454920e96a9e51e63e3d11c0bf64595-7fed.html#WS2d b454920e96a9e51e63e3d11c0bf69084-7cee
    The example works in web based flash project, but if I use the same code in a desktop AIR project image does not move to the mouse position. (this is obvilously after I have changed the Application container to a WindowedApplication container)
    It seems to be due to the fact that the parent container stops receiving mouse move events while dragging. The image then moves to a position relative the where the mouse clicked inside the image.
    I was hoping someone would be able to tell me what I am doing wrong?

    I've managed to solve the issue using event.localX instead.

  • Drag and Drop example porting to Linux does not work

    Hi Guys,
    Encountered this problem : I have a JFrame that displays the name and path of a file that is dragged from a Windows(Explorer) environment into the frame. This works seamlessly in Windows. However, porting to Linux and doing the same thing(dragging the file from File Manager into the Frame to display the file name and path) does not work.
    I suspect the case may be something to do with the flavormap.properties file found in the jdk1.xx/jre/lib file. Can anyone help?
    RG

    Hi,
    I don't know what is causing the problem, but I have been able to avoid it by starting Jdeveloper from $home\jdev\bin\jdev.exe.
    Regards,
    Mathias

  • Drag and Drop (simple)

    Hi guys
    I'm trying to make a simple drag and drop game.  I've named the movie   clip in the properties window as "eye" and have written the following   code in the frame.
    I can pick up the movie clip, but not put it down.  Can someone please help me?
    I've attached the file: http://www.flashadvisor.com/forum/attachment.php?attachmentid=255&d=1285202999
    Any help you can give to help me solve this will be much appreciated by me and a couple of hundred students i teach
    Thanks
    m
    AS3
    eye.addEventListener(MouseEvent.MOUSE_DOWN, pick_up);
    eye.addEventListener(MouseEvent.MOUSE_UP, put_down);
    function pick_up(event:MouseEvent): void {
    trace("pick up ");
    event.target.startDrag(true);
    function put_down (event:MouseEvent): void {
    trace("downdowndowndown");
    event.target.stopDrag();
    eye.buttonMode = true;

    MOUSE_UP event listener should be added to stage - not the object:
    eye.buttonMode = true;
    eye.addEventListener(MouseEvent.MOUSE_DOWN, pick_up);
    function pick_up(event:MouseEvent): void {
         trace("pick up ");
         event.target.startDrag(true);
         stage.addEventListener(MouseEvent.MOUSE_UP, put_down);
    function put_down (event:MouseEvent): void {
         trace("downdowndowndown");
         stopDrag();
         stage.removeEventListener(MouseEvent.MOUSE_UP, put_down);

  • Can't drag and drop or copy multiple photos from iPhoto 9.4.2

    I am trying to export multiple edited (not originals) photo files from iPhoto to finder (actually to place in my Dropbox folder to share with friends/family). This used to be (in previous versions of iPhoto?) an easy case of dragging and dropping a selection of photos, or even a whole event, to the desired location in Finder. However, this no longer seems to work. It seems like it will as when you select and drag the photos, the 'green plus' symbol appears and remains when I move to drop the selection into finder, but then nothing happens. The photos dont transfer.  
    I can still drag and drop a SINGLE photo effectively and it saves in the edited form. I also tried selecting the desired photos, chosing copy and then paste in the desired location in finder. But when I chose 'paste' (right click, paste; or edit, paste) in the desired location, it only pastes a limited selection of the photos which I chose to copy. Not all the photos copy across.
    I cant understand why this is no longer possible as it used to be one of the classic examples of intuitive file actions that I love Apple for. The only way I can find now is to chose to export the selection or event (file, export) but this is much less easy and requires various decisions about the file quality etc. Using this option with various compression options, I have not been able to replicated the "original" file size which is displayed under 'info' for each photo in iPhoto.
    Any ideas please?
    Tom

    Thanks LarryHN thats helpful. I've just tried that and the export 'current' option does indeed re-create the edited photo file with exactly the same file size at that shown in iPhoto. I did consider the 'current' option but was put off by the loss of the metadata with this option. But maybe the old drag and drop approach was the same?
    It's curious that the resulting file size from 'export, current' is different (larger in the example I just tried) in comparison to that resulting from 'export, jpeg' (with either the medium or high option selected).
    OK there seems to be a couple of reasonable options available although neither is as nice as the simple 'drag and drop' which used to be available!!! Why would they remove that option?? (and yet not for single files?).
    Thanks
    Tom

  • How to drag and drop nodes in Tree?

    Hi,
    I want to drag and drop nodes in the tree. For example a tree represents the hierarchy of employees reporting in an organization by using tree.I want to change the reporting an employee visible in the tree by simple drag and drop operation in place of going to another form for updating each employee record indiviually.
    Regards
    Piyush

    Ron,
    I looked into implementing drag / drop in one of the apex trees I created today and ran across this thread. Thank you Ron for the links, it helped a lot.
    I added the code below to my page's "Execute when Page Loads" (tree region id is "tree_reg") and the tree is now drag/drop enabled.
    It did break the [+] icon from collapsing the tree though ... but the apex.widget.tree buttons still work
    var regTree = apex.jQuery("#tree_reg").find("div.tree");
    regTree.tree({ 
    callback : {
    onmove: function(NODE, TREE_OBJ, REF_NODE, TYPE)
    {alert(NODE.id+"   "+TREE_OBJ.id+"   "+ REF_NODE);}
    });Next, I plan on creating a AJAX call using NODE.id, TREE_OBJ.id, and REF_NODE
    V/R
    Ricker

  • Drag and drop or place multiple images

    Hi,
    I'm working with Photoshop Elements 12 and would like to place multiple images (on different layers) in my project but am only able to place one image with the option "place" at a time. Is there a way to place multiple images at once?
    Other option that works in Photoshop is drag and drop mutliple files from my finder window (I'm a MAC user) into the open project. This would create multiple new layers with the imported files. This doesn't work for me with Photoshop Elements 12. When I drag and drop, new projects are created with the imported files.
    Hope someone has an answer for this. Thanks!

    Thanks LarryHN thats helpful. I've just tried that and the export 'current' option does indeed re-create the edited photo file with exactly the same file size at that shown in iPhoto. I did consider the 'current' option but was put off by the loss of the metadata with this option. But maybe the old drag and drop approach was the same?
    It's curious that the resulting file size from 'export, current' is different (larger in the example I just tried) in comparison to that resulting from 'export, jpeg' (with either the medium or high option selected).
    OK there seems to be a couple of reasonable options available although neither is as nice as the simple 'drag and drop' which used to be available!!! Why would they remove that option?? (and yet not for single files?).
    Thanks
    Tom

  • A drag and drop game with dynamic text response

    Hi,
    I am a teacher and my school has recently upgraded to Adobe Design Premium.  Our previous version was about 5 versions out of date.
    I teach A Level which requires students to create an Interactice Multimedia product.
    In the previous 6 years, I have taught students how to create simple drag and drop game with dynamic text responses.
    Since the upgrade to Actionscript 3.0 the dynamic text response has ceased working.
    When creating the game from scratch, I need to move to Actionscript 2.0 as 3.0 does not allow me to add actionscript to objects - I know and am sure that this is a better way of doing things, but I would prefer to keep working the way I am used to.
    I use a switch case statement which I have copied below to make the drag and drop work.  The objects I apply the code to work in that they can be dragged, however, my dynamic text box with a variable name of "answer" is no longer displaying the response when an answer is left on a dropzone (rectangle converted to a symbol and given an instance name).
    on(press) {
    startdrag(this);
    on(release) {
    stopdrag();
    switch(this._droptarget) {
      case "/dropzoneB":
       _root.answer="Well done";
       break;
      case "/dropzoneA":
      case "/dropzoneC":
       _root.answer="Hopeless";
       break;
      default:
       _root.answer="";
       break;
    Any help would be much apeciated.
    Thanks
    Adrian

    To drag in as3
    blie_btn is the instance of the object drawin on the stage. In AS3 you have to assign a even listener, in this case MOUSE_DOWN, and MOUSE_UP, as we want the drag to stop if the mouse is not clicked. Then we fire the functions, and tell the object to start drag.
    // Register mouse event functions
    blue_btn.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
    blue_btn.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);
    red_btn.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
    red_btn.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);
    // Define a mouse down handler (user is dragging)
    function mouseDownHandler(evt:MouseEvent):void {
         var object = evt.target;
         // we should limit dragging to the area inside the canvas
         object.startDrag();
    function mouseUpHandler(evt:MouseEvent):void {
         var obj = evt.target;
              obj.stopDrag();
    if you want to make the text do what you want then something like this might work.
    In the function, you could add a text box onto the stage, give it a instance of something like outputText
    and then:
    outputText = ("Bla Bla Bla");
    (^Not sure if this will work exactly^)
    PS. I am currently a A-level student

  • Drag and Drop Files Onto Seagate External Hardrive

    I can't seem to just drag and drop files I want to store on an external hardrive with Seagate. I hate that. I just want a simple drag and drop so I can free up some space on my computer. But Seagate just seems to just seems to say **** you, we're gonna do it backwards ***. Can someone please explain how to just drag and drop files? I have zero idea, and they don't make it simple to understand.
    So for the love of god....please explain it to me (without use of computer terminology or telling me places I should go on my computer that I don't know what the **** they are. Renders your help useless, and it's frustrating because no matter how many times I ask this, you just give me help i can't understand anyway.)
    Please....it's not hard to ask.
    If possible, use step by step instructions, if you need to tell me to go somewhere on my computer, tell me where that is too so I know where to go. Don't be vague, I can't understand vague instructions when i read them.

    What is the drive formatted as? this is extremely likely the issue.
    FORMAT TYPES
    FAT32 (File Allocation Table)
    Read/Write FAT32 from both native Windows and native Mac OS X.
    Maximum file size: 4GB.
    Maximum volume size: 2TB
    You can use this format if you share the drive between Mac OS X and Windows computers and have no files larger than 4GB.
    NTFS (Windows NT File System)
    Read/Write NTFS from native Windows.
    Read only NTFS from native Mac OS X
    To Read/Write/Format NTFS from Mac OS X, here are some alternatives:
    For Mac OS X 10.4 or later (32 or 64-bit), install Paragon (approx $20) (Best Choice for Lion)
    Native NTFS support can be enabled in Snow Leopard and Lion, but is not advisable, due to instability.
    AirPort Extreme (802.11n) and Time Capsule do not support NTFS
    Maximum file size: 16 TB
    Maximum volume size: 256TB
    You can use this format if you routinely share a drive with multiple Windows systems.
    HFS+ ((((MAC FORMAT)))) (Hierarchical File System, a.k.a. Mac OS Extended (Journaled) Don't use case-sensitive)
    Read/Write HFS+ from native Mac OS X
    Required for Time Machine or Carbon Copy Cloner or SuperDuper! backups of Mac internal hard drive.
    To Read HFS+ (but not Write) from Windows, Install HFSExplorer
    Maximum file size: 8EiB
    Maximum volume size: 8EiB
    You can use this format if you only use the drive with Mac OS X, or use it for backups of your Mac OS X internal drive, or if you only share it with one Windows PC (with MacDrive installed on the PC)
    EXFAT (FAT64)
    Supported in Mac OS X only in 10.6.5 or later.
    Not all Windows versions support exFAT. 
    exFAT (Extended File Allocation Table)
    AirPort Extreme (802.11n) and Time Capsule do not support exFAT
    Maximum file size: 16 EiB
    Maximum volume size: 64 ZiB
    You can use this format if it is supported by all computers with which you intend to share the drive.  See "disadvantages" for details.

Maybe you are looking for

  • Canon Capt printer driver doesn't work under OSX Mavericks

    Since I upgraded to 10.9, my Canon i Sensys LBP 5050 doesn't print anymore. Installing the latest Capt driver (3.65) from the Canon website didn't solve the problem. Any thoughts?

  • Is MBP Fans always on?

    well, I have notice while the room is empty and quit that the MBP Fans working so I got curious I closed every application and Fans still working... I restarted the OS and no application is running, still Fans working at 1999-2000 rpm is that normal

  • AlwaysOn Failure : exception 41005

    While rebooting the secondary side of the failover cluster, the primary availability group hung with the database "resolving". I found these messages in the SQL server log on the Primary AG. Any idea what error 41005 is? Source  spid9s Message Failed

  • How can  uninstall weblogic from  solaris

    Hi How can uninstall weblogic 5.1 from solaris8

  • ActionScript 2.0 class scripts may only define class or interface constructs.

    This is driving me nuts. I have an old AS1 project which I upgraded to AS2. It uses an include file, settings.as, which has stuff like this: settings = new Object(); settings.property = 'some value'; Then I include it on the main timeline like this: