Drag and Drop - target movie clip control

Here's what I want to do.  Currently, I have a drag and drop built in AS 3, which works perfectly well, but I am looking to add one more feature.  What I want to do is when I let fall the correct item drag on its target correct piece, (which is a clip), I want my music video for target to go has a headframe.

I'm so for example dragging a piece of paper on a clip from a waste basket.  When I drop the piece of paper on this topic to the trash, the trash clip moves one a headframe that appears a crumpled paper in it.

Here is my current code for my drop eventlistener:

function dropMe(event:MouseEvent):void
{
event.currentTarget.stopDrag ();

If (Event.currentTarget.hitTestObject (Event.currentTarget._targetPiece))
{
event.currentTarget.x = 950;
event.currentTarget.y = 100;
event.currentTarget.removeEventListener (MouseEvent.MOUSE_DOWN, Drachma);
event.currentTarget.buttonMode = false;

}

on the other
{
event.currentTarget.x = event.currentTarget._origX;
event.currentTarget.y = event.currentTarget._origY;
}
}

If event.currentTarget._targetPiece points to the instance of wastepaper basket, then I think you should be able to target just by using that...

function dropMe(event:MouseEvent):void
{
event.currentTarget.stopDrag ();

If (event.currentTarget.hitTestObject (event.currentTarget._targetPiece))
{
event.currentTarget.x = 950;
event.currentTarget.y = 100;
event.currentTarget.removeEventListener (MouseEvent.MOUSE_DOWN, Drachma);
event.currentTarget.buttonMode = false;
MovieClip (event.currentTarget._targetPiece) .gotoAndStop (2);
}

on the other
{
event.currentTarget.x = event.currentTarget._origX;
event.currentTarget.y = event.currentTarget._origY;
}
}

Tags: Adobe Animate

Similar Questions

  • Expand the drag and drop target area

    Howdy,

    Sorry if this is posted elsewhere I looked but did not find topic...

    I would like to know if there is a way to enlarge the size of the drop target. Seems users must be on-site or shape aligns again.

    Sort of give users a little more flexibility with target drops?

    Thank you!

    go to the timeline of the movieclip containing the sign more.  lock the layer.  Create another layer and make it below your sign.  create a form with an alpha of zero on this layer further down.  test.

  • How to display coordintes xy drag and drop the movie

    can someone tell me how drag to display the coordinates of the Red cirle shown in the tutorial - déposer found here:
    http://www.flashvalley.com/fv_tutorials/advanced_drag_and_drop_in_Flash/
    I did this tutorial very well but do not know how to display its x and y coordinatetes in a dynamic text box as I move the red circle around the screen.
    Thank you for any assistance you can give.
    Steve

    Thank you for your help. Your solution is exactly what I needed.
    :)

  • Drag and drop with joint clips

    I have a button that has a delivery function that attaches a movieclip with startDrag (true) so the attached movie aligns with the mouse and can be moved around. The problem is that I don't know how to configure the onRelease function so that when the mouse button is raised the attached movieclip to be deleted. In addition, the attached movie appear in the top left corner just a moment before snapping to the mouse. What is the best way to implement something like this? Is there a better way of how I'm doing?

    on a timeline:

    button.onPress = function() {}
    attachMovie ("item1", "item1", this.getNextHighestDepth (), {_x:-200, _y:0});})
    item1.StartDrag (true);
    }

    {button.onRelease = button.onRelaseOutside = function ()}

    item1.removeMovieClip ();

    }

  • How to make the clip video symbols communicated once I drag and drop them in place

    Hello all and kglad, I have a problem with the actionscript code that was given to me which works very well but the only problem is that once I drag and drop the movie clip symbol it will not release the symbol in the case of sum I send you the code and someone please help this project is hot on my plate.

    See code below:

    f (subject2);

    function f(mc:MovieClip):Void {}
    mc.onPress = function() {}
    {if(!this.index)}
    This.index = 1;
    } else {}
    This.index ++;
    }
    var d: Number = this._parent.getNextHighestDepth ();
    this.swapDepths(d+1);
    var mcDup:MovieClip = this.duplicateMovieClip (this._name + this.index, d);
    this.startDrag ();
    f (mcDup);
    }
    mc.onRelease = function() {}
    this.stopDrag ();
    }
    }

    Seal55

    You must add:

    mc.onRelease = mc.onReleaseOutside = function() {}
    this.stopDrag ();
    }

    However, I find it odd that you set the anonymous functions inside another function that is a very bad strategy.

    Something more like this would be better, I think:

    function f(mc:MovieClip):Void {}
    mc.onPress = handlePress;
    mc.onRelease = handleRelease;

    mc.onReleaseOutside = handleRelease;
    }

    function handlePress() {}

    {if(!this.index)}
    This.index = 1;
    } else {}
    This.index ++;
    }
    var d: Number = this._parent.getNextHighestDepth ();
    this.swapDepths(d+1);
    var mcDup:MovieClip = this.duplicateMovieClip (this._name + this.index, d);
    this.startDrag ();
    f (mcDup);
    }

    }

    function handleRelease() {}

    this.stopDrag ();

    }

  • How to add a code so my drag and drop movie clip will not stick when he's slipped to o final place

    Hello everyone and kglad, I have to use the old drag and drop code on my video clips, but the problem is when I drag the movieclip to the area on my .swf file as soon as I release it, it sticks to the author of the hand.

    I am encloseing I am using the action script could someone or kglad tell me what is missing in the code so that once he is out it does not stick, see the code below

    circle.onPress = function() {}
    startDrag (this);
    }
    circle.onRelease = function() {}
    stopDrag();
    }

    I am desperate for help on that must get ready for this afternoon

    Seal55

    the following is preferred:

    Circle1.onPress = function() {}

    this.startDrag ();

    }

    Circle1.onRelease = circle1.onReleaseOutside = function() {}

    this.stopDrag ();

    }

  • Several Drag and Drop, several targets. CS5

    Hello:

    I do a Multiple of Drag and Drop in several objectives educational puzzle for child 6-7 years trying to teach them a little on which plants grow in environments in the country. So I have a map of the Mexico divided into 3 different areas: desert, forest and tropic and 6 different plants (3 different groups: cactus, pine and tropical flowers, 2 of each) scattered across the stage and around the map. The goal is for children to put plants in the box to the right and then click on "check" button, which triggers a validation process. Each video clip of the plant has 2 frames with a stop(); action on all: the graph of the plant extends on both images and the second picture has a red sign error graphic that indicates an error occurred (if this is the case). Then the validation process triggered by the "check" button is supposed to move the playback cursor in each placed wrongly move clip factory for the second image to show what plants are displaced and move the playhead of the main timeline to a picture that contains a "Please try again" text and a button "restart Puzzle." If the answers are good, an animation plays saying it was VERY WELL DONE! .

    I searched the Internet for some tutorials and found a file which is pretty close to what I need. I tried to adapt the code to my puzzle but failed miserably. The file is here if you want to check (scroll to the bottom of the page, it is called Soldier.fla). I'm not sticking the code here because it is VERY long, but I will if necessary. If you want that I download the files somewhere else and link them here, I will. If you need me to send them, I'll be happy.

    Here is the structure and instance names in my file:

    Departure:

    -Intro animation

    Map:

    -3 video clips: target_1, target_2 and target_3.

    -Each movie clip has two executives with a stop(); action on each.

    -Each movie clip has a frame-by-frame with a color change to show when a clip of plant fell on her.

    Plants:

    -6 video clips: drag_1, drag_2, drag_3, drag_4, drag_5 and drag_6.

    -Each movie clip has two executives with a stop(); action on each.

    -Each video clip has an invisible button in its background layer called dragbutton1 to dragbutton6 respectively.

    -In the second frame of each clip, I placed a sign of error to be displayed when the boy dropped the clip in the wrong target.

    Placement:

    -video clips drag_1 and drag_3 must be embedded in the target_1.

    -video clips drag_2 and drag_4 must be embedded in the target_2.

    -video clips drag_5 and drag_6 must be embedded in the target_3.

    Buttons:

    -Puzzle AutoScan: main playhead moves to an image named 'play '. It shows after the Intro animation.

    -Check the button: Validation process. If there is any mistakes sends the playhead to main to a named 'wrong' image (here is the text of "Please try" again). If there is no error, sends the playhead to main to a framework called 'good' where begins the animation "Very well done". It shows when start the puzzle.

    -Restart the Puzzle button: moves the main playback head to frame of 'Play '. It shows when start the puzzle.

    -Start button: just restarts. It shows after "Very well done" animation.

    Phew, it was long!

    Now, I'm not a programmer, I'm a designer. I can do buttons and other small things very simplistic but it's just out of my League. Programmers do things my office like PHP (Wordpress, Joomla), a few JS and things like that, but they don't do any ActionScript. They are trying to help but let drop the ball and I tried to understand this since Friday (I took this as a challenge and he lost). The customer wants in AS2, but if you can help me in AS3, screw the customer!

    If one of you can help me with the code, or point me to the right place, I'll be in debt to you. Forever.

    Thank you very much.

    This is a typo and should be:

    var dragA:Array = [drag_1, drag_2, drag_3, drag_4, drag_5, drag_6];

    for (var i: Number = 0; i<>

    [i] dragA dragA [i] ._x = .startX;

    [i] dragA .startY dragA [i] ._y =

    If (i == 0 |) I == 2) {}

    dragA [i] .target = target_1;

    } else if (i == 1 |) I == 3) {}

    Dropped [i] .target = target_2;

    } else {}

    Dropped [i] .target = target_3;

    }

    {dragA [i] .onPress = function ()}

    this.startDrag ();

    }

    dragA [i] .onRelease = function () {}

    this.stopDrag ();

    checkTarget (this);

    }

    }

    function checkTarget(drag_mc:MovieClip):Void {}

    {if (drag_mc. HitTest (drag_mc. Target))}

    feedback. Text = "done Well! »

    } else {}

    feedback. Text = "Missed";

    drag_mc._x = drag_mc.startX;

    drag_mc._y = drag_mc.startY;

    }

  • Just drag and drop them confirmation prompt? Accidentally move files.

    Since the upgrade to Windows 7, we had a problem with people who inadvertently move files by drag-and - drop when the meaning of double-click.  Is there a way to turn on a quick confirmation ("are you sure you want to... ") when drag / drop files/folders?  It seems that the previous versions of Windows had this prompt, but it has since been removed.  What is happening in our offices at least every week, sometimes every day, and we have to spend a lot of time searching for the moved folder.  If MS can't help, is there software that we can buy for this?

    Windows 7 has made no changes: there has never been a request for confirmation that you describe.

    One solution is to increase the distance you need to move the pointer before it triggers a drag.  Under the following registry key, you will see DragHeight and DragWidth, which define the number of pixels the mouse must move before the start of the operation drag is:
    Computer\HKEY_CURRENT\USER\Control Panel\Desktop
  • Drag and drop, 1 share of different sur-succes drag Source, 4 Drop target, for each. Is this possible?

    Hello.

    I created an infographic of type board game and wants that the participant to be able to enter the game room, then drop it into different spaces on the Board, each holding to another slide. I need interaction drag - déposer so that they can pick up and drop the piece. Now, what I need is for each target to have a different action, but even if I add each one to a different group, if I change an action for one, that it applies the change to all drop targets.

    Is there a way to get around this?

    In addition, once / if possible, I would like to add a "back button" on each of these slides and would need when the participant returns to the boardgame slide, they can move the piece to a different drop target to read the following description. I think that the best way to do this would be to make all the "wrong" answers, while the game piece is not stuck once they have fell on a drop target "correct." Please correct me if I'm wrong.

    If I understand you correctly, I think that I thought about it.

    1. Create your Drag and Drop, as you would normally
    2. In the Panel of Drag and Drop, select the Options tab
    3. Click on the button set the correct answers
    4. The value of each drop target to have the source of displacement of the source (you must choose the sequence in the Type drop-down list)
    5. Create the slides that you want to display for each drop target
    6. Select one of the drop targets
    7. Go to the Format of the Panel Drag and Drop tab
    8. The Actions of the object... a button click
    9. In the action column, select go to slide, and then select the appropriate slide
    10. Repeat steps 6 through 9 for each target deposit
    11. Overview of the project

    I did a quick test and it seemed to work according to the settings you said earlier.

  • Drag and drop - moved outside the target object

    Hello

    It's my first drag and drop object.  It went pretty well except for nitpicking a few things.  I'm hoping to get help on one of these.

    A sample of my screen is below.  The basic idea is that you drag one of the words in the dotted box, and I'll give you a sound feedback, whether good or bad.  I'm tiling the answers and this is my question.  Sometimes, if I already have one correct answer in the box and drag each other directly on the existing answer, he'll put it on the side and it seems that it is in the next box.  An example is below.  This happens very rarely, but I still want to go to the bottom of it.  I resized the boxes, made the smaller font and I reduce the size of the response when he goes inside the box.  But it still exists.  If they hang out below the existing response response then it works fine.  Does anyone know what is the answer?  I have the screen below, as well as the settings of the target in the example below that.  any help would be greatly appreciated.  Thank you!

    dnd question.gif

    target settings.gif

    That's the problem with tiling. You can reduce the size of drop even more (90%), try one of the other options in the second row of tiles. Or choose absolute, which means that it has no real alignment, control, but text will stay where the user puts.

  • Legend 1 success for multiple targets in a Drag and Drop Interaction

    I can't see how I can add legends of success to each target in an interaction drag-and - drop, but you can apply only 1 legend success multiple targets?

    1. The limits of smartshapes are overlapping with each other. For example, the smartshape on the 1st line was overlapped with the one on the 2nd line. For this reason, whenever you place the text of the 'Investment' legend on the smartshape on the 2nd line, it automatically moved to the smartshape on the 1st line. As a result, you could never get the right answer, and where you've ever seen the legend of success.

    Solution: Move the smartshapes another (or resize them) and make sure that there is no overlap.

    2, the number of attempts for this interaction has been on infinity. So, you have to play it until you get it right, but could not qualify because of the mention of the reasons above. That's why you have never seen the legend of failure.

    Solution: Disable the infinite in the accordion of Action and specify the required number of attempts. You will get the legend of failure if you don't get it right in these attempts.

    I just tested these solutions and it worked fine. Let me know if you still face problems.

  • MovieClip only, Drag and Drop to multiple targets

    So I've been sitting for the last few hours trying to search the Web for solutions to be able to drag and drop a MovieClip between multiple targets. I have no idea and I am struggling to find something that will help me with this. This is for a class assignment slide / move and I would like to help, please let. This is the general pattern.

    The scene is a multiple-choice questionnaire. There are 3 statements aligned next to 3 boxes, these are my targets. A movieclip appears in the corner, that's the question I want to activate him drag / drop in one of the 3 targets. These targets are named separately as target1_mc, target2_mc and target3_mc. The movieclip that is the 'selector' for the multiple choice is named selector_mc.

    I only know the basic drag and drop the script that has been taught in class, but it's only for one target, not 3. A picture has been provided below. Again, selector_mc is the blue square in the upper part of the screen. Targets (target1_mc, target2_mc, target3_mc) are on the right side of the screen. I want to leave this blue square to be able to drag and drop on targets and areas nod to one of them, invoking a response to it.

    Capture.PNG

    selector_mc.origX = selector_mc._x;

    selector_mc.origY = selector_mc._y;

    {selector_mc.onPress = Function ()}

    this.startDrag ();

    }

    {selector_mc.onRelease = Function ()}

    this.stopDrag ();

    {if (Eval (this._droptarget) == target1_mc)}

    do something. Red Dragon has been selected

    This ._x = target1_mc._x;

    This ._y = target1_mc._y;

    } else

    {if (Eval (this._droptarget) == target2_mc)}

    do something. White Dragon has been selected

    This ._x = target2_mc._x;

    This ._y = target2_mc._y;

    } else

    {if (Eval (this._droptarget) == target3_mc)}

    something.blackdragon has been selected

    This ._x = target3_mc._x;

    This ._y = target3_mc._y;

    } else {}

    all lack em

    This ._x = this.origX;

    This ._y = this.origY;

    }

    }

  • Having problem adding to drag-and - drop operation to move the furniture on a floor plan

    I have the following code. I need to create floor plans where users can drag and drop the furniture on the floor plan.  I have three elements that work but when I convert all of the additional items to a symbol and select movie clip and then add several lines to the code, none work... How the code can determine that my clip I named 'couch' goes to clip 4.  Thanks if you can help, Frankie Foster

    Here is my code:

    var numObjects:uint = 3 / / assign the total number of movieclips that will be dragged

    for (var i: uint = 1; i < = numObjects; i ++) {}

    This ["movieClip_" + String (i)] .addEventListener (MouseEvent.MOUSE_DOWN, clickToDrag);
    This ["movieClip_" + String (i)] .addEventListener (MouseEvent.MOUSE_UP, releaseToDrop);

    }

    var selectedMC:MovieClip;

    movieClip_1.addEventListener (MouseEvent.MOUSE_DOWN, clickToDrag);
    movieClip_2.addEventListener (MouseEvent.MOUSE_DOWN, clickToDrag);
    movieClip_3.addEventListener (MouseEvent.MOUSE_DOWN, clickToDrag);
    movieClip_1.addEventListener (MouseEvent.MOUSE_UP, releaseToDrop);
    movieClip_2.addEventListener (MouseEvent.MOUSE_UP, releaseToDrop);
    movieClip_3.addEventListener (MouseEvent.MOUSE_UP, releaseToDrop);


    function clickToDrag(event:MouseEvent):void
    {
    selectedMC = MovieClip (event.currentTarget);
    selectedMC.startDrag ();
    }

    function releaseToDrop(event:MouseEvent):void
    {
    event.currentTarget.stopDrag ();
    }

    stage.addEventListener (KeyboardEvent.KEY_DOWN, nextQuestion);

    function nextQuestion(event:KeyboardEvent):void {}
    trace (Event.keycode);
    if(Event.keycode == Keyboard.Right)
    {
    selectedMC.rotation += 5;
    }

    if(Event.keycode == Keyboard.Left)
    {
    selectedMC.rotation-= 5;
    }
    }

    It is not a conflict, but it's a waste of code because they are both the same thing.  The first with the right loop is more effective in terms of coding and will make life easier for you because you only need to adjust the numObjects value to have it include more.

    You just need to assign instance names for the rest of your objects in the same way... movieClip_ # code as you (with loop version) should be enough.

  • Drag and Drop 2 objects 1 target

    I'm relatively new to Flash and try to create a drag and drop.  I followed the tutorial here (http://monkeyflash.com/tutorials/flash-drag-and-drop/). A change that I made this tutorial was having the object disappear when it is deposited on the target.  By following these instructions, I was able to build a drag and drop of an object to a target successfully.  My question is what do I do if I want to have several items to go to the same target?  For example in the tutorial that happens if I added a second square object and both wanted to go to a target square.

    Any help would be greatly appreciated!

    As long as the target is always available as a target, you can drag to as many objects as you want (one at a time).  To help do that, when you drop an object on the target and make disappear, either to do this object fall go far (removeChild (dropped)) so that it does not block the path or move the target above the object dropped (addChild (target)).

  • How to move several JPEGs from one file to another not to drag and drop.

    I'm a prolific snapper and need to move from an intermediate file jpeg images to a monthly file without the risks of drag and drop. Anything involving pictures would be useful.

    Copy / paste? What dangers drag and drop represent them?

    Your question is vague. Is it a complete folder of images? Or a selection from a folder of images?

    Some possibilities: Automator, Hazel, AppleScript, you can do even in applications like Lightroom if you wish.

    But hard to advise without some details.

Maybe you are looking for

  • Necessary iOS operating system forums?

    Yes we have various forums App for iOS and iOS applications, but no forum of using iOS as it is for Mac OS X. Such topics as they appear: IOS screen broken in 10.11.4 recording capacity? And people want to know if features of iOS is broken or impleme

  • Drivers needed WLAN for Satellite C855-1KP, Windows 7 Ultimate 32 bit

    Hello I have a Toshiba Satellite C855-1KP, part PSKCAE-04600QG5 number, and I can't find the driver wireless on the web.I scanned my laptop TOSHIBA PC Diagnostic toll-free and appear to the network: Network Realtek RTL8723AE Wireless LAN 802.11n PCI-

  • 15 - f010dx: I need to reset my password on

    Hello. I need to reset my power on password. The number that appears after 3 attempts is 85524480.Thank you very much.Patrick

  • How can I uniinstall the software that are corrupt

    I want to uninstall the software that is not properly installed and during uninstall, it says that the uninstall file is corrupt

  • Animate with a timeline panel

    HelloI recently started using Photoshop for animation, and he is fine, except for one thing:Whenever I want to draw on a picture, I need to click on it or the layer first, otherwise I get 'is currently out of range for the target layer '...Is it poss