Drag and Drop in Flash ?

I cannot seem to
get the script correct?
Can anyone let me knwo if it is the script that incorrect or the naming etc of my movieclips..
basically I want several of the movie clip pegs to be able to be dragged and dropped and snap to the targets...i will be moving the image of the call centre over the top of the targets but i have moved it aside to show that I had created the targets.
All assistance is greatly appreciated.
FIRSTLY.. how do i attach the the zip file???
Kylie

One thing to get things on the right track would be to use the function names that you specify for the drag and drop.  The listeners use (bolded)...
one_mc.addEventListener(MouseEvent.MOUSE_DOWN, fl_clickToDrag);
one_mc.addEventListener(MouseEvent.MOUSE_UP, fl_releaseToDrop);
But you only have the following functions...
function pickUp(event:MouseEvent):void {
function dropIt(event:MouseEvent):void {
Either the listeners need to use the right function names or the function names need to be changed to match what the listeners specify

Similar Messages

  • Drag and Drop Bug (Flash, AS3)

    Hello! Help, please! I'm making a game that involves dragging and dropping books. (Right now there is only one book.) While testing my game, I discovered by accident that no matter where I drag on the screen, the draggable book responds, moving around on screen despite the cursor not being on top of it. Here is my code. (It also snaps a larger book mc to the small one for purposes I intend to use later.)
    // Making the small book dragable. //
    small_book.addEventListener(MouseEvent.MOUSE_DOWN, fl_ClickToDrag_6);
    // when the mouse button is clicked...
    function fl_ClickToDrag_6(event:MouseEvent):void
        small_book.startDrag();
        big_book_mc.x = small_book.x;///
        big_book_mc.y = small_book.y;///-----> Makes the big book snap to the lil one when clicked.
    stage.addEventListener(MouseEvent.MOUSE_UP, fl_ReleaseToDrop_6);
    // when the mouse button is released...;
    function fl_ReleaseToDrop_6(event:MouseEvent):void
        small_book.stopDrag();
        big_book_mc.x = small_book.x;///
        big_book_mc.y = small_book.y;///-----> Makes the big book snap to the lil one when the mouse button is released.
    stage.addEventListener(MouseEvent.MOUSE_DOWN, dragFn);
    // if the mouse is currently dragging....;
    function dragFn(event:MouseEvent):void
        small_book.startDrag();
        big_book_mc.x = small_book.x;///
        big_book_mc.y = small_book.y;///-----> The big book follows while the mouse is dragging.
    // the small book is now draggable and the big book snaps to it.

    your stage listeners should be added in the mousedown listener functions and then removed in the mouseup listener functions.
    and just to clarify, your small book starts dragging no matter where there is a mousedown?

  • Flash Proffession CC 2014 HTML5 Canvas drag and drop not working

    Hi,
    I am making drag and drop in Flash professional CC 2014 using canvas and it is working fine on desktop but same when I am testing in Android tablet it is not working.  Can any one please advise how to make drag and drop application from Flash CC 2014 which will work on both web/pc desktop HTML5 canvas and all android devices.
    Thanks

    I just discovered something.  What I meant above is that I cannot drag and drop files from the "Media Browser" panel.  Surely that should be possible.  After all, that is how you browse your music files.  If I first double click a file in the browser so that it opens in the "Files" panel, I can then drag and drop files from there.  That is ridiculously tedious however because that opens the wave file and closes the "CD Layout" panel.  I then have to reopen the "CD Layout" panel before I can drag and drop a file.  I'm pretty sure you should be able to simply drag and drop from the Media Browser.  Any comments from Adobe?

  • Newby to Flash -- need help with Drag and Drop

    I have been trying to create a drag and drop in Flash where I have five different places for an instance of a mc to be dropped. I want to be able to drop only three instances to each place and these three instances are specific to one of the five "drop places".  I also want the mc instance to go back to its original position if it is not dropped on the right place.  I've got the actionscript working to drag and drop the mc instances on the "drop places"  but I cannot figure out how to do the if statements so that if it doesn't match the correct drop place it will go back to its original position.
    Here's some of my code:
    Analyze1_mc.objName = "Analyze1";
    Analyze1_mc.val = 1;
    Design1_mc.objName = "Design1";
    Design1_mc.val = 4;
    Analyze1_mc.buttonMode = true; // sets mouse pointer to hand
    Design1_mc.buttonMode = true;
    Analyze1_mc.addEventListener(MouseEvent.MOUSE_DOWN, fl_ClickToDrag);
    Analyze1_mc.addEventListener(MouseEvent.MOUSE_UP, fl_ReleaseToDrop);
    Design1_mc.addEventListener(MouseEvent.MOUSE_DOWN, fl_ClickToDrag);
    Design1_mc.addEventListener(MouseEvent.MOUSE_UP, fl_ReleaseToDrop);
    var originalPosition:Point;
    function returnToOriginalPosition(): void
              originalPosition = new Point(x,y)
              x = originalPosition.x;
              y = originalPosition.y;
    // function to drag item clicked
    function fl_ClickToDrag(event:MouseEvent):void
              event.currentTarget.startDrag();
              event.target.parent.addChild(event.target);
    function fl_ReleaseToDrop(event:MouseEvent):void
              var target:MovieClip = event.currentTarget as MovieClip;
              var item:MovieClip = MovieClip(event.target);
              item.stopDrag();
    if (event.target.hitTestObject(AnalyzeTarget_mc)  && (event.target.val == 1)) {
                                            trace ("Analyze1");
                                            event.target.x = AnalyzeTarget_mc.x + 42;
                                            event.target.y = AnalyzeTarget_mc.y + 5;
                                            updateItem(Analyze1_mc);
                                  } else {
                                            returnToOriginalPosition();
    if (event.target.hitTestObject(DesignTarget_mc) && (event.target.val == 4)) {
                                            trace ("Design1");
                                            event.target.x = DesignTarget_mc.x + 42;
                                            event.target.y = DesignTarget_mc.y + 5;
                                            updateItem(Design1_mc);
                                  } else {
                                            returnToOriginalPosition();
    function updateItem(item:MovieClip):void {
              buttonMode = false;
              removeEventListener(MouseEvent.MOUSE_DOWN, fl_ClickToDrag);
    I put the trace in to check the function -- and I do get the output when the mc instance is dropped on the right place -- but there is no return to original position if the instance is dropped in the wrong spot and there is no update to the mc instance. 
    Any help would be greatly appreciated. Thanks!

    That line you speak of is merely declaring a variable, nothing is being assigned to it.
    One way of assigning the original position data to each object is to just assign it like follows:
    Analyze1_mc.originalX = Analyze1_mc.x;
    Analyze1_mc.originalY = Analyze1_mc.y;
    etc...
    Another way to do it with less code is to assign it generically just before you start dragging each of them...
    function fl_ClickToDrag(event:MouseEvent):void
              event.currentTarget.originalX = event.currentTarget.x;
              event.currentTarget.originalY = event.currentTarget.y;
              event.currentTarget.startDrag();
              event.target.parent.addChild(event.target);
    One thing I noticed in your code earlier is that you switch between using event.currentTarget and event.target.  If you want to be sure that the object your code is targetiing is the object that has the listener assigned to it (your movieclips) stick with using currentTarget.   target can end up pointing to something inside that object instead of the object itself.  In the following lines...
              var target:MovieClip = event.currentTarget as MovieClip;
              var item:MovieClip = MovieClip(event.target);
    You could very well be assigning target and item as being the same object.  I don't think that is what you want.  You might wanting to have one of them be the object you drop it on, which would be the dropTarget, not the target

  • Drag and Drop without Overlapping.

    Can anyone give me direction on using 'drag and drop' in flash without overlapping?
    For example - I have a list of buttons i drag to an area on the stage.
    I do not want my buttons to overlap.
    Any ideas? Tutorial / example... anything - I'm new on this and i'm in a crunch.
    Thanks,
    Jackie

    Hi kglad,
    Thanks for your response.
    Are you available online? Im not even sure if i'm allowed to ask that on here =/ ... im really new to the forum.
    My MSN is [email protected]
    Skype: jackie_parks
    I'm so stressin' about this issues, was wondering if you might look at my project with me?
    Thank you very much.
    Jackie

  • About Drag and drop issue

    As title, i am a newbie to flash using ActionScript 2.0 , and currently i enounter the problem with drag and drop coding. Below is my code:
    function dragSetup(clip, targ, position) {
    clip.onPress = function() {
    startDrag(this);
    clip.x +=2;
    clip.swapDepths(clip.x);
    clip.onRelease = clip.onReleaseOutside=function () {
    stopDrag();
    if (eval(this._droptarget) == targ) {
    this.onTarget=true;
    gotoAndStop(position);
    } else {
    this.onTarget=false;
    gotoAndStop(position);
    clip.myHomeX=clip._x;
    clip.myHomeY=clip._y;
    clip.onEnterFrame = function() {
    if(this.onTarget)
              this._x-=(this._x-this.myHomeX)/5;
              this._y-=(this._y-this.myHomeY)/5;
    function dragSetup2(clip, targ, correct) {
    clip.onPress = function() {
    startDrag(this);
    clip.x +=2;
    clip.swapDepths(clip.x);
    clip.onRelease = clip.onReleaseOutside=function () {
    stopDrag();
    if (eval(this._droptarget) == targ) {
    clip._visible = false;
    this.onTarget=false;
    gotoAndStop(correct+1);
    } else {
    this.onTarget=false;
    gotoAndStop(correct);
    var frame:Number = 1;
    dragSetup2(flexibleTxt, questionBox, frame);
    dragSetup(transparentTxt, questionBox, frame);
    dragSetup(blueTxt, questionBox, frame);
    dragSetup(TIRTxt, questionBox, frame);
    dragSetup(TRTxt, questionBox, frame);
    dragSetup(ssmTxt, questionBox, frame);
    dragSetup(siliconTxt, questionBox, frame);
    dragSetup(silicaTxt, questionBox, frame);
    dragSetup(silicateTxt, questionBox, frame);
    dragSetup(infraTxt, questionBox, frame);
    dragSetup(radioTxt, questionBox, frame);
    dragSetup(lightTxt, questionBox, frame);
    dragSetup(copperTxt, questionBox, frame);
    dragSetup(gopTxt, questionBox, frame);
    dragSetup(liquidTxt, questionBox, frame);
    The scenario is , whenever correct mc was drag and drop on the target mc , it move to the next frame with new target mc(new question) , for example "questionBox2".
    By applying the code above, everything work fine but i would like that whenever i "throw" the answer mc (flexibleTxt, blueTxt etc) , i want it to slide or glide for little more distance, jz like how u throw a card in real life on a smooth surface.
    I also prefer that when draging it's "angle?" change according to the direction of draging. For example if u point ur finger on north side of a card and drag to the east, it's "angle?" will change according to the direction u drag, in this case, means east.
    I know my description seem abit complicated but i really someone can undestand and help me solve this issue.
    This is the link i reference to for the code above,but i modify it to my own preference :http://www.swinburne.edu.au/design/tutorials/P-flash/T-How-to-drag-and-drop-in-Flash/ID-37 /
    PS : can i attach my fla file in this forum? if can, why i cant found any attach button?

    I am having a similar but reverse problem: Under 10.5.2, when trying to push or pull files from my wireless MacBook Pro via my Airport Extreme base station to or from my wired G5 Power PC, files hang in mid copy then stall.
    The other way around -- working from the G5 -- I have no problem at all.
    This started with 10.5, but I'm not sure if it was .1 or .2 because I upgraded from 10.4 just recently and did the combined 10.5 updates all at once on both machines.
    Thanks

  • How to drag and drop another swf or fla into a template?

    I am building a flash website for a friend. We are using templates he purchased at flashden.net.
    I normally use wordpress, joomla and other such systems and am familiar with html, php, cgi and such.
    This is my first time dealing with a flash template.
    I have downloaded the trial version of the software and he wants to purchase adobe flash professional for me
    So that we can edit the template and add features he wants in the future.
    The website that sells the templates says you can easily drag and drop addons to templates in flash
    but I am not finding it so easy. Is there somewhere online where I can find a tutuorial on how to step by step
    drag and drop flash files into another template etc.?
    Also, where can I find good tutorials in general? I have downloaded adobe flash for dummies it is not as indepth as I need
    to get a handle on this software.
    Thank you to anyone that offers me any advice,
    David Doherty

    Ned,
    Thank you for responding.
    Flashden.net does claim its a simple drag and drop operation to do this but they have little to know information on the site about the subject and
    having difficulty with the sellers on step by step instructions. They claim it's easy it may be.
    The person I am building the website for had a bad experience with one of the sellers who refused to offer anything but basic instructions and claimed the cost of the software was not worth his time.
    Here are the instructions that were provided:
      Open news_rotator.fla
      Go to library.
      Select and copy NewsRotator movie clip.
      Paste it into your own project’s library.
      Now, you can drag and drop it into your own movie clips.
      Use news.xml to add/remove headlines.
    As you can see from what your telling me this is insufficent information on how to drag and drop this flash into another flash template.
    I will attempt to contact other selers at flashden for information as I have other flash templates we have purchased.
    Thank you,
    David Doherty

  • Recommend me a good drag and drop tutorial

    I need to make a movie whereby the user drags four items onto 4 targets and achieves a result as each object lands on the target, such as a sound. and then a well done statement at the end.
    Can anyone recommend me a place where I can download such a file so I can manipulate it? I figured an hour ago when i sat at my computer that I would find one easily, but I'm really stuck now. can anyone suggest a tutorial/ site where I could get a free download of an advanced drag and drop like this?
    I'd really appreciate your help!
    Thanks.
    Niamh.

    These are the 2 good tutorials that helped me in making Drag and Drop in flash : http://www.flashvalley.com/fv_tutorials/advanced_drag_and_drop_in_Flash/
    http://www.actionscript.org/resources/articles/26/1/Drag-n-Drop-and-Drop-Targets/Page1.htm l
    Thanks,
    Sudheendra

  • Flash Drag and Drop Template in Captivate.  *HELP*

    Good morning.
    I am attempting to use the drag and drop learning interaction
    that comes pre-packaged with Flash CS3 and import it into Captivate
    for use in a Captivate based e-learning exercise.
    I create the drag and drop just fine in Flash, and it looks
    perfect when I publish it in Flash, etc.
    When I attempt to use the EXACT same SWF in Captivate,
    however, it does not work. I can move the drags around the screen,
    but they will not "drop" where they are supposed to.
    Thinking maybe I broke the template, I went ahead and just
    imported it 100% unchanged from Flash into Captivate (without me
    messing around with it changing things around) and it does the
    exact same thing.
    I have successfully used my own homemade flash "widgets" in
    Captivate, to include like click and reveal type interactions...for
    whatever reason, though, I can't get this one to work, even though
    I know it works perfectly in Flash.
    The .swf file was developed using ActionScript 2.0 in Flash
    and I tried publishing it with Flash 9 and Flash 8 as the setting,
    both do the same thing.
    Help!!!?
    Thanks.
    Rob

    Hi R
    Note that the Border simply adds space to the project so the
    playback controls aren't covering part of your movie. Assuming you
    want that to continue AND have a playback control, you might resize
    the project so the playback control is included in the main movie
    as well as being placed in an area that doesn't possibly obscure
    any screen activity.
    Cheers... Rick

  • Flash drag and drop not working on Firefox for android browser

    Drag and drop functionality is not working using Firefox Browser for Android on tablet. We tested with flash action script 2.0 & 3.0 content, both have same issue. Specs of the tab and OS are as follows.
    Android - Kitkat 4.4.2
    Tab models - Lenovo A7600H and Samsung Tab4 T531
    Please refer to a previous case raised on the same issue here at this link (Case 1029615) - https://support.mozilla.org/en-US/questions/1029615
    Additionally, we observed that the object on which Drag and Drop event was triggered, is moving little bit when we double tap.
    Does Firefox provide any libraries to support Drag and Drop functionality on Flash? We are using Geekoview api to execute flash content in our app. Will the same support be provided in Geekoview as well?
    Are there other folks facing the same issue? Is there a solution or workaround to get this feature running?

    Flash on Android is no longer supported by Adobe. While Firefox does support basic functionality we mainly focus on legacy video applications. You may run into issues with Flash and Geckoview. I doubt we have any resources to support that configuration.

  • How do I copy messages in a Mail folder to a flash drive?  Drag and drop is not working.

    How do I copy messages in a Mail folder to a flash drive?  Drag and drop is not working!

    Try doing a save as to the desktop and then try dragging thr .rtf file to the usb drive

  • Flash drag and drop

    When I import any kind of Flash drag and drop interaction,
    including ones made by Macromedia/Adobe I can get the drag to work
    but not the drop. Anyone any ideas?

    Hi funqueen,
    The question reminds me of a slightly perverted version of
    the tree falling in the forest. Whether or not anyone is there to
    see it, what does a *drop* look and sound like? LOL!
    My best offering is to use Captivate. If you are a Flash
    person, that may sound daft, but give it a try. Just begin your
    recording, making sure that the Full Motion is enabled in your
    preferences, and during the recording, left-click-and-drag an
    object to a new location, then release the left mouse button to
    drop the object.
    It takes a little practice to make this work smoothly, but it
    works every time, and you certainly do not need to import anything
    built in Flash to make it work. If more info is needed, please
    advise your version of Captivate, and exactly what process you are
    having trouble with. Thanks!
    best wishes~
    Larry

  • Drag and Drop with a response in Flash..please help

    Hi
    I have just started with flash and actionscript3 about 5 weeks ago. I'm in my first year uni and I have a drag and drop assignment (for a kindergarten class). Its "little Red Hen" and they have place the correct picture in right holder.
    I have gotten the drag and drop working but I can't seem to figure out how to display a tick when they have place it in the correct holder.
    Please help....
    This is my script (it may seem messy...still new)
    import flash.events.MouseEvent;
    /*Mouse Event that ensures the function of hen movieclip to start dragging
      when mouse is pressed*/
    hen1_mc.addEventListener(MouseEvent.MOUSE_DOWN, dragStart);
    hen2_mc.addEventListener(MouseEvent.MOUSE_DOWN, dragStart);
    hen3_mc.addEventListener(MouseEvent.MOUSE_DOWN, dragStart);
    hen4_mc.addEventListener(MouseEvent.MOUSE_DOWN, dragStart);
    hen5_mc.addEventListener(MouseEvent.MOUSE_DOWN, dragStart);
    hen6_mc.addEventListener(MouseEvent.MOUSE_DOWN, dragStart);
    function dragStart (event: MouseEvent):void
        event.target.startDrag();
    /*Mouse Event that ensures the function of hen movieclip to drop
    when the mouse button is realeased with Condition statement, if
    hen = holder, hen snaps into place*/
    hen1_mc.addEventListener(MouseEvent.MOUSE_UP, dragStop1);
    function dragStop1 (event:MouseEvent):void
        hen1_mc.stopDrag();
        if (hen1_mc.hitTestObject (holder1_mc)==true)
            hen1_mc.x=holder1_mc.x;
            hen1_mc.y=holder1_mc.y;
    hen2_mc.addEventListener(MouseEvent.MOUSE_UP, dragStop2);
    function dragStop2 (event:MouseEvent):void
        hen2_mc.stopDrag();
        if(hen2_mc.hitTestObject (holder2_mc)==true)
            hen2_mc.x=holder2_mc.x;
            hen2_mc.y=holder2_mc.y;
    hen3_mc.addEventListener(MouseEvent.MOUSE_UP, dragStop3);
    function dragStop3 (event:MouseEvent):void
        hen3_mc.stopDrag();
        if(hen3_mc.hitTestObject (holder3_mc)==true)
            hen3_mc.x=holder3_mc.x;
            hen3_mc.y=holder3_mc.y;
    hen4_mc.addEventListener(MouseEvent.MOUSE_UP, dragStop4);
    function dragStop4 (event:MouseEvent):void
        hen4_mc.stopDrag();
        if(hen4_mc,hitTestObject (holder4_mc)==true)
            hen4_mc.x=holder4_mc.x;
            hen4_mc.y=holder4_mc.y;
    hen5_mc.addEventListener(MouseEvent.MOUSE_UP, dragStop5);
    function dragStop5 (event:MouseEvent):void
        hen5_mc.stopDrag();
        if(hen5_mc.hitTestObject (holder5_mc)==true)
            hen5_mc.x=holder5_mc.x;
            hen5_mc.y=holder5_mc.y;
    hen6_mc.addEventListener(MouseEvent.MOUSE_UP, dragStop6);
    function dragStop6 (event:MouseEvent):void
        hen6_mc.stopDrag();
        if(hen6_mc.hitTestObject (holder6_mc)==true)
            hen6_mc.x=holder6_mc.x;
            hen6_mc.y=holder6_mc.y;

    Ok so I figured it out, thank you Ned.
    I have made the tick_mc alpha 0 in the beginning of the script and then in my conditional I have made the alpha = 100
    So it works...yay!
    Now all I have left, if the piece is placed in the wrong holder then it needs to go back into its orignal position.
    I have tried
    Written above the script
    var startX:Number;
    var startY:Number;
    then just below my dragStart code
    startX = event.target.x = startX;
    startY = event.target.y = startY;
    then after each if statement I placed an else statement
    else
          hen1_mc.x = startX;
          hen1_mc.y = startY;
    Its clearly not working, please could you tell me what I am doing wrong?
    thank you

  • Flash Drag and Drop interaction

    I have created a Flash SWF with a drag and drop interacation.
    Previewed in Flash, it works perfectly; the mc object can be picked
    up, and locks on the target when released, and dynamic text
    displays to tell the user that the match is right.
    When imported into Captivate, the swf appears to be a static
    file. Nothing can be moved.
    I redid it using older actionscript allowing it to be
    exported as a Flash v6 file; in this version, the mc object can be
    moved, but does not lock on the target when dropped, and the
    dynamic text box is blank.
    Both Flash and Captivate are CS3.
    Is this simply not compatible in Captivate? Searching for
    help on drag and drop isn't helpful because it brings up info
    relative to the drag and drop quiz, which is not what I need; this
    file is dragging and dropping images.
    Any assistance will be greatly appreciated, thanks!

    I don't know how much help it will be but you should check
    out
    this
    link to a page at Paul Dewhurst's web-site "RaisingAimee". You
    may not be able to get to that page until you register as a user on
    Paul's site. If you run into that, register, then try the link
    again.
    If this is any help to you, drop a few pieces-of-eight in
    Paul's PayPal account, and maybe send him a personal "thank you" on
    his Shout Box. If it doesn't work, it might be because those
    particular FLAs were created for version 1, as I remember, and may
    be to some extent version-specific. In any case, it might be worth
    a try.
    ~best wishes for your success,
    Larry

  • Drag and drop between different Flash objects

    It is possible to drag & drop items between different flash objects?

    Yes, you can drag and drop anywhere on the stage.  You'll need to explain things in more detail if there's more to your question.

Maybe you are looking for

  • Can somebody help me with this code?

    Can anyone help me with this code? My problem is that i can't seem to position this form, i want to be able to center it vertically & horizontally in a div either using CSS or any other means. <div id="searchbar"><!--Search Bar --> <div id="searchcar

  • Windows 7 Network Drivers No Longer Works

    Bought a MBP a week ago, just installed Windows 7 on its own partition, installed bootcamp, everything worked fine for the first day. The next day, it did not recognize my network drivers (wireless, ethernet). Control Panel states that they are not i

  • Installing on Windows 7, IE, get error message "run time error has occured in script"

    when attempting to install latest version of Flash Player on Windows 7 computer with IE, during installation I get message "runtime error has occured in script". & installation ceases.  what can I do to obtain Flash Player on my computer?  Aaron

  • Zen Vision: M apparently enjoys rebuilding the libr

    Well I have 30g Zen Vision:M, and everytime I reboot or it has to do its loading thing (where It starts up for about 5 seconds before it plays music after it's been off for 5+ hours or something), It starts rebuilding the library. I have tried the Cl

  • Uploading edited photos from Lightroom to Picasa

    Hi I have recently purchased Lightroom 4. I have edited my photos and saved them as JPEG. I exported them to my computer and wanted to select some for my Picasa web album. I have never resized previously and uploaded full size as I thought they are m