Drag and drop of MC to the other?

Hello

I created a bunch of MCs since a single MC in the library dynamically.

Inside the timeline of the MC, I wrote drag and drop code.

The MC is a parent movieclip, then residing in a scrollpane.

I was wondering if it is possible to write AS3 to drag the clips into an another movieclip?

If this isn't the case, the way I got it, is it at all possible to drag one MC container to another MC?

Thank you

Shaun

You will need to create a new listener that monitors for MOUSE_MOVE which can constantly check the position of the cursor from whatever you intend to impose limits.  But the real test by you could be a little tricky to manage in terms of use of a hitTestObject approach since you can't test the object moved against its parent (because it in itself defines the limits of the parent).  You can optionally create another object within the parent that you test over hitTestObject using, maybe we you the alpha 0 for value so that you can't see.

In all cases, the general approach would be something to the effect of...

MC3.addEventListener (MouseEvent.MOUSE_DOWN, dragIt);
function dragIt(evt:MouseEvent):void {}
MC3.StartDrag (false);
MC3.addEventListener (MouseEvent.MOUSE_MOVE, checkIt);
}

MC3.addEventListener (MouseEvent.MOUSE_UP, dropIt);
function dropIt(evt:MouseEvent):void {}
stopDrag();
MC3. RemoveEventListener (MouseEvent.MOUSE_MOVE, checkIt);
}

function checkIt(evt:MouseEvent):void {}
If (CONDITIONAL LIMITS OUTSIDE GOES HERE)) {}
dropIt (evt);
}
}

Tags: Adobe Animate

Similar Questions

  • Drag-and - drop text reader to the other application does not work

    Hello

    I have disabled protected mode in acrobat reader of the registry key... HKCU\Software\Adobe\Acrobat Reader\11.0\Privileged\bProtectedMode REG_DWORD 0

    This works when Acrobat Reader native app is used. When I open a PDF file in the browser (Acrobat Reader Plugin for IE11) then drag / drop do not work. Select, right click copy, destination Application as Word 2013 right click Paste, works.

    We use 11.0.12. Same problem was 11.0.11 too.

    Any ideas?

    Kind regards

    Roland

    Hi supports,

    Web browser uses only the PDF viewer plugin to view PDF files. It will have the same feature of the player.

    So if you want to use the drag & drop feature, please stick to the player application.

    Kind regards
    Nicos

  • Cannot drag and drop photos in Facebook or other websites

    MacBook Pro. Upgrade to El Capitan - now I can't drag and drop photos in Facebook or other Web sites.

    Add them via the button share after you add your Facebook account to accounting/system preferences window.  Regarding Web sites use the functionality of the browser like this for Safari media browser:

  • cannot drag and drop a shortcut on the desktop of the address bar.

    I can drag and drop a shortcut to the menu of bookmarks. I can't drag and drop in the menu bookmark on the desktop. I can't drag and drop the address bar on the desktop.

    You drag the text selected in the address bar or the button "Site Identity" (lock/globe)?

  • Not able to drag-and - drop to import into the project

    Hello

    I'm simply is no longer able to drag and drop images to import the premiere pro cs6 project.

    (File is .avi created from Premiere Pro CS6, common parameters Media Encoder).

    Can someone help me with this?

    Windows 10

    Thank you very much, Bob, of the Peru.  That helped a lot.  It turns out that I had put Premiere Pro CS6 to run as administrator.

    Initially, I started first with the pressed-in shift (to reset preferences), but that didn't solve it.

    That's when I remembered, I tried 'run as administrator '.

    See you soon!

  • Cannot drag and drop a pattern to the color chart

    I have a PC with Windows 10 so maybe that's part of the problem.

    I've been working with a very detailed model and using the function drag / move in the color chart with no problems.  Then all of a sudden it stopped working.  Any thoughts?  I can drag and drop other items in, but not this model more.  Any thoughts?

    Try and select the object complete, then object > model > done. This can generate a more descriptive error message. Will there be a clipping mask in your work?

  • Drag and drop copy works but no other task can be done during copying

    I can drag and drop copy, but no other tasks cannot be executed during the copy. Is this "normal" or a bug?

    It is normal and expected for large displacement and falls.  If you need to move large files or allow large groups of file, and then transfer them via VMware Shared Folders and or a share of normal network (SMB/CIFS) for multitasking.

  • Need to drag and drop video clips over the keyboard to rotate

    My project is to allow visitors to the website drag furniture on a floor plan. I need all items be independent of each other with drag and drop and then be able to rotate each item with an arrow on the keyboard.

    The code I have allows all drag-and - drop, but I can't get the code to rotate an element. If anyone can help, I certainly appreciate. My Action Script 3 following code:


    / * Drag and Drop
    Makes the instance for the specified symbol with drag and drop furniture.
    */

    movieClip_1.addEventListener (MouseEvent.MOUSE_DOWN, fl_ClickToDrag);

    function fl_ClickToDrag(event:MouseEvent):void
    {
    movieClip_1.startDrag ();
    }

    stage.addEventListener (MouseEvent.MOUSE_UP, fl_ReleaseToDrop);

    function fl_ReleaseToDrop(event:MouseEvent):void
    {
    movieClip_1.stopDrag ();
    }

    / * Drag and Drop
    Makes the instance for the specified symbol with drag and drop furniture.
    */

    movieClip_2.addEventListener (MouseEvent.MOUSE_DOWN, fl_ClickToDrag_2);

    function fl_ClickToDrag_2(event:MouseEvent):void
    {
    movieClip_2.startDrag ();
    }

    stage.addEventListener (MouseEvent.MOUSE_UP, fl_ReleaseToDrop_2);

    function fl_ReleaseToDrop_2(event:MouseEvent):void
    {
    movieClip_2.stopDrag ();
    }

    stage.addEventListener (KeyboardEvent.KEY_DOWN, nextQuestion);


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

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

    }

    Thank you, Frankie

    Create a variable to determine the last selected movieclip and allowing to target in the keyboard code.  Here is a smaller version of your code that does this, where drag and drop functions are shared by objects that can be moved...

    var selectedMC:MovieClip;

    movieClip_1.addEventListener (MouseEvent.MOUSE_DOWN, clickToDrag);
    movieClip_2.addEventListener (MouseEvent.MOUSE_DOWN, clickToDrag);
    movieClip_1.addEventListener (MouseEvent.MOUSE_UP, releaseToDrop);
    movieClip_2.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;
    }
    }

  • How to drag and drop multiple movieclips at the same time

    Hello world

    I'm a new actonscript 3 and adobe flash CC user and I am building an application but I have been stuck for several days. I have looked everywhere and tried everything I could think of, but I can't yet find a solution to my problem that I thought were pretty basic.

    Basically, let's say I have a rectangle and a circle on the stage. Once I did of the movieclips and assigned an instance name to each of them, I want to be able to perform a drag and drop the Rectangle so that both the rectangle and the circle become movable at the same time.

    For now, I have a mouse down events listener associated with the instance of rectangle, a method startDrag assigned to the rectangle instance and another assigned to the circle. But in this configuration, when I click on and drag the rectangle, only the circle is mobile (only the last line in the code is taken into account).

    I don't know if what I'm trying to achieve is feasible, but any help will be greatly appreciated, thank you!

    The startDrag() method can only work for one object at a time, so in your case the Treaty the last of them, designated the task.  This approach is to temporarily to plant the two objects in a container and then drag the container.

    rectangle.addEventListener (MouseEvent.MOUSE_DOWN, fl_ClickToDrag);  When I click on the rectangle

    var dragMC:MovieClip = new MovieClip();
    addChild (dragMC);

    function fl_ClickToDrag(event:MouseEvent):void

    {
    dragMC.addChild (rectangle);        move objects in the container
    dragMC.addChild (circle);
    dragMC.startDrag ();
    }

    stage.addEventListener (MouseEvent.MOUSE_UP, fl_ReleaseToDrop); When I release the mouse button

    function fl_ReleaseToDrop(event:MouseEvent):void

    {
    dragMC.stopDrag ();
    Rectangle.x += dragMC.x;         Adjust the positions of the objects to their new location
    Rectangle.y += dragMC.y;
    Circle.x += dragMC.x;
    Circle.y += dragMC.y
    addChild (rectangle);                 move back to the scene objects
    addChild (circle);
    dragMC.x = dragMC.y = 0;       reset the benchmark for the dragMC
    }

    All this stuff of repositioning in the Drop function is necessary because when you drag the container, the positions of the content are still on their original coordinates inside the container.  So when you drop them they will resume their x / y positions in their new parent, meaning they go back where they were.  Reposition them where they have been trained to take into account the change in the position of the dragMC.

  • 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 work stoppages until the computer restarts

    We are experiencing a problem on some machines (Windows 7 SP1 64 bit) where slide - déposer ceases to function in all applications.

    For example, in Windows Explorer, you can initiate the drag, but when you release the mouse button to make the 'drop' the drag image/icon remains right on the screen.  Once you press the ESC operation key drag is cancelled and slide it image/icon disappears.

    There seems to be a sequence of actions in various applications as the user doest that tests the problem.  Even after closing all applications and even restarting Windows Explorer, disconnect and reconnect the mouse, the problem persists.  A reboot seems to be necessary to solve the problem.  We cannot identify any resource that is used as memory, GDI and user handles objects, etc., to the top.   Windows Process Monitor and Process Explorer have not ben useful.

    Do we know if there are a few key resources being locked that prevents drag it / move to fill?

    Actually figured this out in part.  It seems to be related to an application that has been hanging mouse events and leaving the passage of events in a bad state of a certain type.

  • Drag and drop with audio for the success or failure for each object

    Captivate 7

    I saw Pooja video on at least 20 times, literally, but I can't yet find the complete instructions anywhere. Not even in things, I spent a lot of money on. Ouch.

    ed.png

    I want to drag "ed" & "and" and get a snap sound as they settle. I got it work. But when he moves the words in the wrong location, I want a sound alert, allowing them to know that it is a mistake and do not want the box to accept the term.

    Sometimes video of Pooja, but it does not show how. I'm pulling out my hair. Soon it will get ugly around here.

    Sorry for that, I always use advanced actions and sometimes forget (late in the evening) that everyone knows with them.

    If you want to only play an audio clip when an object is moved and don't need a legend to appear or are happy with a legend of single failure (you can check that a new that), you can replace the command execute measures advanced in the screenshot of the other thread in "Play Audio"... »

    I've used here a clip audio, available with Captivate in the Gallery\Sounds

    Lilybiri

    PS: Since the CP6 I use the word "container" instead of legend because the text can be inserted, not only in the text captions, but also in the forms (my favorite)

  • Hi, I want to drag and drop a file in the form (in a grid view of data in the table of attachments in database-type access is incidental)

    I am using visual basic 2010. A shape has a datagridview named in an attachment that is connected to a binding source (access database) named attachments. The columns are attached and description. The attachment is not of type text, this is the type of attachment. How to download files in the access database by using my VB form.

    Can anyone suggest me how do. I'm new to VB. It'll be good if you can provide the code.

    Hello

    Your question is more complex than what is generally answered in the Microsoft Answers forums. It is better suited for the MSDN Developer audience. Please ask your question in the following forum.

    VB general forum:
    http://social.msdn.Microsoft.com/forums/en-us/vbgeneral/threads

    Concerning

  • Cannot drag and drop widgets (content) on the home page

    I have Windows Vista Ultimate Edition with Service Pack 2 and IE 9 on a 32-bit platform. My home page content cannot be moved. Make my icons on the desktop and working my doc files. What is the problem? Can I added the content simply not move anywhere on the page where I want.

    Hello

    1. don't you make changes to the computer until the problem occurred?

    2. this happens with all the gadgets?

    I suggest you to try the steps below and check if it helps.

    Uninstall, and then restore the desktop gadgets. Follow the steps to uninstall the gadgets.

    a. right click on the empty area of the desktop and then click Gadgets.

    b. right-click on the gadget and then click Uninstall.

    Steps to restore the Google desktop gadgets:

    a. click Startand then click Control Panel.

    (b) in the search box, type Restore the Gadgets.

    c. click Restore gadgets installed with Windows Office

     

    Hope this information is useful.

  • I can't make screenshot o do drag and drop on the desktop

    Hi all

    When I do a screenshot (entire window or a selection) I do not see the genereated .png image, but it plays the sound "trigger". If I drag and drop a file on the desktop, the file is not visible.

    If I alt + right click on station Home/Finder icon and re - open Finder, files are visible.

    I tried to remove the com.apple.finder.plist and other files, as illustrated in a tutorial, but after some time of work, it brokes again.

    On the console there are no significant errors.

    Any help is appreciated. Thank you.

    If I understand your description of the problem, no files at all are visible on the desktop. You restart the Finder and the files reappear, but then at some point, they disappear again. Is this correct?

Maybe you are looking for

  • Pls help with Apple TV 3!

    Hello everyone! I have a big problem with my Apple TV 3 (model MD199LL/A). I need your help... I watched my Apple TV yesterday and it started to reboot. Light - thinking 3 min and restar... I connected Apple TV for iMac and did restore from iTunes. N

  • I have an Iphone from GoPhone ATT 6 is unlocked or not Buyed

    I have an Iphone from GoPhone ATT 6 is unlocked or not Buyed I mean I paid $ 550 for him and it IS a PREPAID phone and also no contract, so if I go to India Can I use it if yes please answer Me if not please give me a Solution what to do and how to d

  • 778044-00, duration of Vision 778044-03 and 778044-35

    Vision Run Time part number changed? : first 778044-00 and then 778044-03, 778044-35 778044-35 is currently available. I need the 778044-03 because that is the 2011 version. '778044-35' will work with the Vision 2011 Run Time? Thank you!!

  • Cannot install Service Pack KB953297 Framework1.1

    All antivirus scans are clean!  System Restore has tried on a date prior to this installation without success.  I mainly use Firefox as my browser & Explorer 7.

  • Software update = more heat... Impossible... Yes? .. .wrong

    My computer has updated last night... auto update (the last update). It contained 15 new updates, anyway... when I got home the next day I turned on my computer, to find all works 5 to 10 degrees warmer... ahh? It's technically impossible... but its