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);

Similar Messages

  • Drag and drop simple ".mov" files, into 2 dif. browsers, no longer working

    -
    Did something, that caused my main drag and drop, of simple ".mov" files, into 2 different browsers - "Safari", Version 3.0.4, and "Camino", Version 1.6.8, .. to stop working.
    To be clear, this is regarding, just some simply ".mov" files which I have generated. (Individual hourly, weather images - like; in sequence. Generated, in / with, QuickTime - itself.)
    At this point, where dropped from a folder, into "Camino", .. it routes these back to my main desktop. - (Before the problem, .. played them, in browser.)
    "Safari", only brings up the folder that the main file is in — within a separate folder window.
    (As with "Camino", played these in browser, previously.)
    (Have gone into "preferences", either browser, .. and can't figure things from there.)
    Problem occurred follow two different downloads / installations
    "DjVu Browser Plug-in"
    http://www.caminova.net/en/downloads/download.aspx?id=1
    and, ..
    "Flash Player" (.. for Mac OS 10.4 - 10.5)
    http://get.adobe.com/flashplayer/otherversions/
    Have tried, either "uninstalling", .. or "trashing" these.
    (Uninstalled, "Flash Played" - with specific "Uninstalled" app.. / "Trashed" "DjVu Browser Plug-in".)
    Any help, certainly appreciated.
    Rm(richard583a)

    -
    It, .. or they, don't within either browser that I have installed - and am using, ..
    .. they had previously, ... don't know what I did exactly to caused this circumstance.
    .. is my question. (.. if not fully clear.)
    Just looking to try to find out what I can do, either whether to "back-off" from what I've done - more recently, regarding the two different downloads that I've pointed to above, .. apparently - only, having, superseded a more simply configuration .. previously working.
    This, or either, adjust the settings - broader / somewhere (more generally) - otherwise, .. in order to have these files, play, .. in browser.
    Rm(richard583)

  • Drag and drop files to library on a Mac

    Does anyone know how to do this? I feel silly asking how to drag and drop...yet it doesn't appear to be allowed on my Mac. I don't want to import to library because I import a lot of PNGs most of the time and Flash creates symbols for me (again, only on a Mac, not a PC). Is this some sort of ploy from Adobe to get Flash designers off Macs? I just think using Flash on a PC is MUCH more user friendly than on a Mac. There are other reasons I think this.
    Anyway, if there is a way to drag and drop to the library, I'd love to hear it. thanks for any help!

    Hi,
    So, I assume you are dragging and dropping objects from your machine directly to Library pod or to your Slide.
    Are these images/sounds located on network?
    No, on the same drive (c:).
    Try Closing Captivate and Right Click--Run As -Administrator and check if it is still doing the same behaviour on a enw project.
    I've tried this. Same result.
    Usually when you drag and drop an object -- if it is movable to destination is shows a small "+" and if not it shows "x" next to the faded dragged object. 
    Can you please try these and if it still happens, can you add some more information?
    I've tried to drag and drop simple files, like jpg, mp3, swf... what ever. Nothing works. I've got the same problem on my home office system, wich is totally different to my working station here. My colleague here in my room has pretty the same system, and it works fine.
    Windows 7 (32 bit), CP5 installed, CS4 installed, CS 5.5 installed, CP5.5 installed
    What else you wanna know?

  • Drag and drop to target simple errors, expecting identifier?

    im creating a drag and drop. moving a guitarest name to a target e.g draging a movieclip called slash to a dynamic text box called box_slash this is my code and i get 2 stupid errors but have been up all night and cant figure it out!
    flash cs5 actionscript 3, is this code for actionscript3 i found the base for it here: http://edutechwiki.unige.ch/en/Flash_drag_and_drop_tutorial any help would be incredible as it for an assignment and im new to flash
    var hits = 0;
    // Register mouse event functions
    slash.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
    slash.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);
    clapton.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
    clapton.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);
    hendrix.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
    hendix.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.dropTarget will give us the reference to the shape of
              // the object over which we dropped the circle.
              var target = obj.dropTarget;
              // If the target object exists the we ask the test_match function
              // to compare moved obj and target where it was dropped.
              if (target != null)
                        test_match(target, obj);
              obj.stopDrag();
    function test_match(target,obj) {
              // test if either one of the four pairs match
              if ( (target == box_slash && obj == slash) ||
                 (target == box_clapton && obj == clapton) ||
                   (target == box_hendrix && obj == hendrix) || )
                        // we got a hit
                        hits = hits+1;
                        textField.text = "Correct! :)";
                        // make the object transparent
                        obj.alpha = 0.5;
                        // kill its event listeners - object can't be moved anymore
                        obj.removeEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
                        obj.removeEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);
                        // Test if we are done
                        if (hits == 3)
                                  textField.text = "Well Done";
              else
                        textField.text = "wrong! :(";
    the errors are: i have highlighted the lines
    Scene 1, Layer 'Actions', Frame 1, Line 39
    1084: Syntax error: expecting rightparen before leftbrace.
    Scene 1, Layer 'Actions', Frame 1, Line 38
    1084: Syntax error: expecting identifier before rightparen.

    Thankyou very much that does get rid of that error now i get
    Scene 1, Layer 'Actions', Frame 1, Line 42
    1120: Access of undefined property textField.
    Scene 1, Layer 'Actions', Frame 1, Line 51
    1120: Access of undefined property textField.
    Scene 1, Layer 'Actions', Frame 1, Line 56
    1120: Access of undefined property textField.
    now im sure this is simple but im as im sure you have figured out im a complete noob to flash
    textField.text = "Correct! :)";
      textField.text = "Well Done";
    textField.text = "wrong! :(";
    is this something to do with an instance name?

  • 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/

  • 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.

  • Making simple Cross desolves at the end of still photo clips from my library. Not making a clean disolve beteen. Single frames from the previous clip are flashing half way through the desolve. Did both a drag and drop and insert disolve.

    Making simple cross desolves at the end of still photo clips from my library.
    Not making a clean disolve between clips.
    Single frames from the previous clip are flashing half way through the desolve.
    Did both a drag and drop and insert disolve.

    Making simple cross desolves at the end of still photo clips from my library.
    Not making a clean disolve between clips.
    Single frames from the previous clip are flashing half way through the desolve.
    Did both a drag and drop and insert disolve.

  • 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.

  • There is absolutely NO way to drag and drop newly purchased music from the Purchased list on the phone into my iTunes library?  I'm finding it hard to believe that something so simple cannot be done!

    I like to make MP3 CD's when I have people over, or when my friends have people over so I can just pop them into the CD player and let them play all night without having to worry about changing the CD or anything.  Well, Apple's music is in AAC format, so I have to convert the songs to MP3 files using the converter in iTunes.  So I'll convert them to MP3's and just delete the AAC file so I don't have doubles.  The problem is, the next time I plug the phone into my laptop to transfer new purchases, iTunes thinks that the songs I converted aren't there anymore because the phone has them as AAC files, and iTunes has them as MP3 files, so it doubles the music again...EVERY time!!  It's very frustrating!  So this is why instead of clicking Transfer Purchases, I would like to be able to just drag and drop the songs I want from the Purchased list on the phone into my iTunes library.  I hope I explained this right...lol.  Unfortunately, it doesn't seem like I'm able to do that.  I'm hoping maybe somebody here can help me out and give me some pointers on what to do about this.  Thanks!!

    That stinks!  I can actually do that at my house...I just plug my iPhone right into the wire that's plugged into my receiver in my living room...but some of my friends aren't "technology savvy"...lol...so they just have DVD players and I'll put the CD in there because it will read an MP3 disc.  What's funny, is I have the phone set to "Manually Manage Music", and when I plugged it into the laptop just now, the one song I downloaded last night on the phone, transferred over to the iTunesl library.  That NEVER happens.  And it only transferred the one song...it didn't double the other songs like it ususally does.  I swear, iTunes does what it wants, when it wants sometimes...lol.  Thank you for your quick response. 

  • Drag and drop file into email gets me an icon, not the image. Is there a simple fix?

    I am used to drag and drop image import into apple email. Recently I get a "mail attachment" icon for images that have been previously sent in other email. I would like to see the actual image in every email if possible. How can that happen?

    Thanks for the help. Dragging the thumbnail onto the album tab works great. Too bad this was not a bit clearer in the previous posts.

  • One SIMPLE, SIMPLE question that the answer seem to be no whre IN PLAIN ENGLISH! What do you have to do to have two of more tabs open at the same time. Just like ANY OTHER BROWSER LETS YOU DO! Ya know....so you can drag and drop things like pics etc.

    For Pete's sake. This is not rocket sience. What more details do you want. I want two tabs OPEN at the same time so I can copy from one to the other or drag and drop from one to the other.

    You can copy text and hover that selected text with the left mouse button down on another tab on the tab bar until that tab opens and drop the text in a text field in that tab. You need to make sure that that text area is visible because you can't scroll the page. You can also tear off that tab (temporarily) to a new window and resize them to see both windows. Move the tab back to the other window once you are done if you prefer that.

  • Select All in a table does not work for Drag and Drop

    Hi. I am using Jdeveloper 11.1.1.2 but have also reproduced in 11.1.1.3.
    I am trying to implement drag and drop rows from one table to another. Everything works fine except when I do a Select All (ctrl-A) in a table, the table visually looks like all rows are selected, but when I try to click on one of the selected rows to drag to the other table, only the row I click on is dragged.
    I tried setting Range Size -1, fetch mode to FETCH_ALL, content delivery to "immediate" but nothing works.
    I even have reproduced not using a view object but just a List of beans with only 5 or 10 beans showing in the table.
    Does anyone know how to get Select All to work for a Drag Source?
    Thanks.
    -Ed

    Frank-
    OK, thanks for looking into that. I also submitted this service request, which includes a simple sample app to demonstrate the problem:
    SR #3-2387481211: ADF Drag and Drop does not work for rows in table using Select All
    Thanks again for the reply.
    -Ed

  • Visual Studio opening files when dragged and dropped in WPF app debugging session

    I'm working on a WPF app (using VS2013 CE) which is intended to manage media files (TV Shows, movies, etc) and as part of this I am enabling the user to drag and drop media files on to the running app (by adding AllowDrop="True" and PreviewDragEnter="Window_PreviewDragEnter"
    to my Window definition).
    The problem I have is that when I drag files onto the app in a debugging session Visual Studio then opens the file(s) when I stop debugging... this is seriously annoying as when I am testing with large media files (> 1GB) it just locks up VS for minutes
    at a time while it tries to open the file or files. When I run the app outside the debugger this does not happen - it's only when I'm in a VS debugging session.  The only way I can stop this happening is to kill VS completely from Task Manager then restart
    it - this is also very annoying but often I need to do this as it will freeze up for 5-10 minutes while it insists on loading the files in VS.
    I understand the app, whilst debugging, is running in the context of VS but why does VS then have to try to open the files when debugging is finished?   I have looked through the options but can't see anything to switch this off and no amount of searching
    has turned up anything - can anyone put me out of my misery with a solution to this annoying issue?

    Hello nzmike,
    Does Visual Studio behaves like the following image shows and just hangs when opening your media file?
    Do you have any other computer which installs Visual Studio? Can you reproduce this on it?
    In order to troubleshoot this issue I think we need to locate the root reason of your issue. The problem can related to the following:
    1. Your project is corrupt and VS then trys to load that file when debug finished.
    2. Your VS is corrupt and caused this problem.
    So please do something below:
    1. Try clean and rebuild your project.
    2. Switch to some other PCs and use VS and your project there, check if the problem can be reproduced.
    3. You can backup your VS setting and try some commands: devenv /resetsettings and devenv /resetuserdata
    Details about VS command:https://msdn.microsoft.com/en-us/library/xee0c8y7.aspx
    And based on th research of the above second step, if you can reproduce this issue on more than one PC, the problem is pending on your project and I need you to share a simple sample which can reproduce this issue. We will need to investigate the project
    in detail.
    Best regards,
    Barry
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Drag and drop a URL from IE's address bar

    I have a Processing application written (by others) that uses [Andreas Schlagel's sDrop library|http://www.sojamo.de/libraries/drop/] to accept URLs dragged and dropped from the users' browsers' address bar. The application works fine for Chrome and for Firefox and for old versions of IE but not for IE 9 or IE 10. I'm investigating how to fix this.
    In the sDrop library [the Java code to handle the drop|http://code.google.com/p/sojamo/source/browse/trunk/src/sojamo/drop/DropHandler.java] uses the Java class DataFlavor which in turn defines a number of flavours:
    imageFlavor
    javaFileListFlavor
    javaSerializedObjectMimeType
    plainTextFlavor (deprecated)
    stringFlavor
    Over on StackOverflow one questioner enumerates the data formats offered by the different browsers when they drop and for IE he lists:
    UntrustedDragDrop
    msSourceUrl
    FileGroupDescriptor
    FileGroupDescriptorW
    FileContents
    UniformResourceLocator
    Effects: Link
    The URL format does not seem to match the DataFlavors given by the class. Is this where the two additional DataFlavors, javaJVMLocalObjectMimeType and javaRemoteObjectMimeType come into there own? If so, then can someone point me at any samples, examples, tutorials, or code snippets where a Java application is the successful drop target for a URL dragged from IE's address bar?

    Dragging an URL '''OR''' the 'favicon' does '''NOT''' work when you want to drag this to a sub 'folder' in your bookmarks. e.g. I drag an URL or favicon to Bookmarks, I have a sub-folder called 'Recipes' where I want to drop the dragged object. I position the mouse over 'Recipes' and the sub-menu appears. I move the dragged object to drop this on the recipe list in the sub-menu and the sub-menu simply disappears. Equally, I CAN drop this on the top level BM menu but it does not drop in the place needed (I want this (e.g.) NOT at the bottom but two up from there. What happens is that the dropped URL appears to locate it self in a random position. Easy to replicate by dragging the same URL to the BM menu and it drops wherever it feels like. FF team have clearly failed to do some basic testing on this and there are many (correction MANY) other annoying things like this that show there has been poor or insufficient testing. I have been a fan of FF for a long time and recommended it to others. Now I cannot do this with confidence and am seriously thinking of switching back to an old version. However, I might simply go to Chrome. Are you listening FF team? A simple look at the forums will show the groundswell of annoyed people. You have altered the way many things work, seemingly focusing on prettifying things rather than ensuring stability and ensuring basic features continue to work...

  • 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

Maybe you are looking for

  • Pop-up message on iPhoto start-up

    I get the same pop-up message twice every time I start iPhoto. It says (in Dutch): The iPhoto-library contains 4 pictures which are not imported. Would you like to import them now? If I choose [YES] or [NO], I get the same question on the next startu

  • Imovie project cannot be finalised in my new MBP 15".

    I purchased MBP 15" retina display 2013, 2.7 GHz Intel Core i7,Memory 16 GB 1600 MHz. After completing a 46 mnts imovie project, I experienced 2 problems: 1) Always fail to 'finalise" the project. Coud it be the size of the project approx. 10 GB too

  • How can i import quizzes made on keynote to iweb with hyperlinks active?

    I have made some quizzes on keynote using hyperlinks, but cannot find a way to import them onto my iWeb site with the hyperlinks still active. I've exported the quizzes to html and they work fine, but I can't import them onto an iWeb page. I even tri

  • Converting secured audiobook to mp3 or wav.

    Hello there, I recently bought a audiobook trough the Itunes store and now have a problem. Since they are secured files and each of the files are over an hour of playtime I can't convert them to mp3 or burn them to an audio cd since they are way to b

  • Is this legal/genuine

    Is it safe to buy this Copy [link removed] Cloud programs do not have lifetime licenses, you subscribe for some amount of time (monthly or annually) and you pay monthly I went to the reserved area and asked, and the conclusion is the site is a scam