Drag-and - déposer gets stuck on other objects

I have this objects (named room) that you can drag mailboxes (called target), and they get in the x and position the box there if it is correct, but if the subject is droped above another object it gets stuck, it was suppose to return to its place of origin (designated otherwise) if the hitTestObject isn't the right box.

PS: it only seems to happen on the Witch of piece code located slot, for example: stuck piece1 exhibit2 and 3, 4, 5..., but is not stuck exhibit2 on piece1.

Wonder if anyone can help, thanks in advance and excuse my bad English,

Here is the code:

import flash.events.Event;

import flash.events.MouseEvent;

stage.addEventListener (Event.ENTER_FRAME, EntFrame);

function EntFrame(e:Event):void

{

/ * Arrastar e soltar

Torna an instance do symbol address mobile com arrastar e soltar.

*/

piece1_mc.buttonMode = true;

piece1_mc.addEventListener (MouseEvent.MOUSE_DOWN, fl_ClickToDrag_1);

function fl_ClickToDrag_1(event:MouseEvent):void

{

piece1_mc.StartDrag ();

}

piece1_mc.addEventListener (MouseEvent.MOUSE_UP, fl_ReleaseToDrop_1);

function fl_ReleaseToDrop_1(event:MouseEvent):void

{

piece1_mc.stopDrag ();

If (target5_mc.hitTestObject (piece1_mc.tar1_mc))

{

piece1_mc.x = target5_mc.x;

piece1_mc.y = target5_mc.y;

}

on the other

{

piece1_mc.x = else1.x;

piece1_mc.y = else1.y;

}

}

/ * Arrastar e soltar

Torna an instance do symbol address mobile com arrastar e soltar.

*/

piece2_mc.buttonMode = true;

piece2_mc.addEventListener (MouseEvent.MOUSE_DOWN, fl_ClickToDrag_2);

function fl_ClickToDrag_2(event:MouseEvent):void

{

piece2_mc.StartDrag ();

}

piece2_mc.addEventListener (MouseEvent.MOUSE_UP, fl_ReleaseToDrop_2);

function fl_ReleaseToDrop_2(event:MouseEvent):void

{

piece2_mc.stopDrag ();

If (target1_mc.hitTestObject (piece2_mc.tar2_mc))

{

piece2_mc.x = target1_mc.x;

piece2_mc.y = target1_mc.y;

}

on the other

{

piece2_mc.x = else2.x;

piece2_mc.y = else2.y;

}

}

/ * Arrastar e soltar

Torna an instance do symbol address mobile com arrastar e soltar.

*/

piece3_mc.buttonMode = true;

piece3_mc.addEventListener (MouseEvent.MOUSE_DOWN, fl_ClickToDrag_3);

function fl_ClickToDrag_3(event:MouseEvent):void

{

piece3_mc.StartDrag ();

}

piece3_mc.addEventListener (MouseEvent.MOUSE_UP, fl_ReleaseToDrop_3);

function fl_ReleaseToDrop_3(event:MouseEvent):void

{

piece3_mc.stopDrag ();

If (target2_mc.hitTestObject (piece3_mc.tar3_mc))

{

piece3_mc.x = target2_mc.x;

piece3_mc.y = target2_mc.y;

}

on the other

{

piece3_mc.x = else3.x;

piece3_mc.y = else3.y;

}

}

/ * Arrastar e soltar

Torna an instance do symbol address mobile com arrastar e soltar.

*/

piece4_mc.buttonMode = true;

piece4_mc.addEventListener (MouseEvent.MOUSE_DOWN, fl_ClickToDrag_4);

function fl_ClickToDrag_4(event:MouseEvent):void

{

piece4_mc.StartDrag ();

}

piece4_mc.addEventListener (MouseEvent.MOUSE_UP, fl_ReleaseToDrop_4);

function fl_ReleaseToDrop_4(event:MouseEvent):void

{

piece4_mc.stopDrag ();

If (target4_mc.hitTestObject (piece4_mc.tar4_mc))

{

piece4_mc.x = target4_mc.x;

piece4_mc.y = target4_mc.y;

}

on the other

{

piece4_mc.x = else4.x;

piece4_mc.y = else4.y;

}

}

/ * Arrastar e soltar

Torna an instance do symbol address mobile com arrastar e soltar.

*/

piece5_mc.buttonMode = true;

piece5_mc.addEventListener (MouseEvent.MOUSE_DOWN, fl_ClickToDrag_5);

function fl_ClickToDrag_5(event:MouseEvent):void

{

piece5_mc.StartDrag ();

}

piece5_mc.addEventListener (MouseEvent.MOUSE_UP, fl_ReleaseToDrop_5);

function fl_ReleaseToDrop_5(event:MouseEvent):void

{

piece5_mc.stopDrag ();

If (target3_mc.hitTestObject (piece5_mc.tar5_mc))

{

piece5_mc.x = target3_mc.x;

piece5_mc.y = target3_mc.y;

}

on the other

{

piece5_mc.x = else5.x;

piece5_mc.y = else5.y;

}

}

/ * Arrastar e soltar

Torna an instance do symbol address mobile com arrastar e soltar.

*/

piece6_mc.buttonMode = true;

piece6_mc.addEventListener (MouseEvent.MOUSE_DOWN, fl_ClickToDrag_6);

function fl_ClickToDrag_6(event:MouseEvent):void

{

piece6_mc.StartDrag ();

}

piece6_mc.addEventListener (MouseEvent.MOUSE_UP, fl_ReleaseToDrop_6);

function fl_ReleaseToDrop_6(event:MouseEvent):void

{

piece6_mc.stopDrag ();

If (target6_mc.hitTestObject (piece6_mc.tar6_mc))

{

piece6_mc.x = target6_mc.x;

piece6_mc.y = target6_mc.y;

}

on the other

{

piece6_mc.x = else6.x;

piece6_mc.y = else6.y;

}

}

Visible P2

If (piece6_mc.x == target6_mc.x & &)

piece5_mc.x == target3_mc.x & &

piece4_mc.x == target4_mc.x & &

piece3_mc.x == target2_mc.x & &

piece2_mc.x == target1_mc.x & &

piece1_mc.x is target5_mc.x)

{

P2. Visible = true;

stage.removeEventListener (Event.ENTER_FRAME, EntFrame);

}

on the other

{

P2. Visible = false;

}

}

Add the MOUSE_UP listener on stage instead of for the object that is dragged.  Add in the case where the handler for the MOUSE_DOWN event, then remove the MOUSE_UP listener where the manager what it treats.  Example:

piece1_mc.buttonMode = true;

piece1_mc.addEventListener (MouseEvent.MOUSE_DOWN, fl_ClickToDrag_1);

function fl_ClickToDrag_1(event:MouseEvent):void

{

piece1_mc.StartDrag ();

stage.addEventListener (MouseEvent.MOUSE_UP, fl_ReleaseToDrop_1);

}

function fl_ReleaseToDrop_1(event:MouseEvent):void

{

piece1_mc.stopDrag ();

stage.removeEventListener (MouseEvent.MOUSE_UP, fl_ReleaseToDrop_1);

Tags: Adobe Animate

Similar Questions

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

  • Download "Importing Options" when you perform a drag-and - d├⌐poser place?

    Is there a way to get the "Importing Options" prompt when you place an element in InDesign by 'Drag and Drop '?

    place.jpg

    I think that if you use the bridge instead of the Finder, and you hold the SHIFT key while selecting the place in InDesign, you also get the import options. Not as simple as drag and drop, but easier to find your files in the Place dialog box, perhaps.

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

  • Drag-and - d├⌐poser adds 8 hex code of the character before the title of folder in the folder

    Sansa Fuze 8 GB

    V020226A

    Windows Vista

    Automatic detection of USB Mode

    I dragged and dropped a lot of albums in memory internal and external files (music), but for some reason any on some issues of the album (not all but most) there was a 8 digit code added in front of the name of the folder, in the folder. Like the 0DF00000_Blind - Blind Melon Melon.

    I like to navigate by folder and bought the "rocket" as she does, but they added numbers screws to the top of the list of albums.

    I read another post where someone has got these numbers added during the transfer through Media Player but there is no solution for drag / drop.

    I don't know a lot about the modes USB etc. One option would be to force the MSC mode, clear all, and then re - file to see if that helps?

    Help appreciated!

    Try to use the manual mode to MSC. There is a reason why the mode that you are using is called "Failure to Auto".

  • PSG - MSC, WMP, Winamp, drag-and - d├⌐poser that nothing works for me to create playlists!

    Hello

    Was very happy to buy the 8 GB Sansa Fuze player and now I am totally frustrated with it.

    I have 2000 songs and I put them on the drive by drag / move (player was still in the factory settings). I had well organized my songs into folders because the ID3 tags are not all good, and I don't want to sit and edit the tags of 2000.

    Obviously the player does not function to browse the folders so I started looking in the creation of playlists and he hass nothing but frustration since then.

    I read almost all of the discussions about this and tried modes of the MTP and MSC and everything. Nothing works.

    Windows Media 11 and Winamp player always without success.

    Here's what I want to do:

    1. create playlists for each folder, I added in the 'Music' folder on the rocket, using the files on the "rocket" and not my computer being the music that I have loaded on different media (external hard drive / CD / etc).

    2 be able to navigate to these playlists and play according to what I want.

    I'm not a geek, but I'm not a starter. So all sorts of solutions welcome.

    Please help me. I really want to throw the player rather than scroll through the songs of 2000 or modify their ID3 tags.

    Feeding you the Lil Monsta first.  It's OK, but the "rocket" can have problems, find the files if they are not correctly tag tags ID3v2.3 ISO-8559-1.

    Music files display correctly when browsing the device?

    The "rocket" recognizes a variety of bit rates, as long as the files are in mp3 or wma format.

    What you need to do is to take the files you have created and edit the ID3 field data as you wish, to group the files if you want.  If the files are grouped together in folders, you can extract the files (or pull the source even if they are available on your PC) and work top with MP3Tag, available for free download.

    I have not tried, but it may be possible to change the files on the device, and then save them to the "rocket" and delete the mtable.sys file in the root directory before you leave or disconnect the "rocket". What I hope will happen, is that the original ID3 tag database will be rebuilt using your tags edited.

    I mention this workaround solution, since you have already loaded 2000 files on the device.

    The sticky issue is the 'default', used when you load your music.  MTP mode out-of-the-box, by default the "rocket" at less than your operating system of the Sansa queued data to open a session of MSC mode communication, based on automatic detection.

    The probability is higher that, since you mention WiMP11, PSG is the mode of choice.  The file mtable.sys in the root directory is not seen in MTP mode.

    Have you tried to synchronize your rocket with WiMP11?  The synchronization process can work in the opposite direction, pulling songs from the device in the library of your Media Player.  Once there, you can use the "Advanced" tag editor to correct tags, but MP3Tag can work on whole batches of similar files for you, or it may even take your entire collection of, say, ID3v2 tags and rewrite as 2.3 with the correct character set.

    Chicken can allow you to generate playlists on your PC and send the .pla playlist file to your Sansa. (No, the files are NOT duplicated in a teeny .pla file, here is only a list of files!)

    Finally, when you're connected in MTP mode, navigate to the music folder.  You can generate playlists at will, especially when they are already on the device using Windows Explorer in MTP mode. Choose a desired file, right click to create Playlist.  Rename this playlist as you want and open it.  Now, drag and drop all your titles in this list box.  Note Please!  You're not actually dragging the files in the list, just the TITLES go from there - how cool is that!

    Two towers with lots of files: If you have a list, hold down the [SHIFT] key will allow you to extract all the files between the two clicks as a group, or now the [CTRL] will allow you to consolidate each individual file clicked until the release of [ctrl key].  Then, drag one of the files selected to the playlist, and all selected files will follow.

    I prefer to drag these new playlists in playlist file, which makes them easier to find later, compared to the research of the multitude of files in the music folder.

    Bob

  • Files lost after file drag-and - d├⌐poser.

    Several times, I tried to drag and drop a folder, including its contents, to another folder of collection. Levels were usually jpegs ranging from a few hundred. After the drag and drop I hopened the file. He had only a short text telling him: this folder is empty. How to retrieve the summary?

    I discovered today that I tried to moved files from one partition to another. The destination partition became full and window has found a different place on the source partition to move the rest of the files. Them there.

    Thanks for the tips

  • Drag-and - d├⌐poser has stopped working on Windows 7.

    There seems to be many possible solutions here, but none seems to work for me. Why isn't someone from Microsoft tell us just what the problem - officially - instead of having to fix it ourselves!

    Hi Richard,

    Learn the steps of Vaseem Ahmed http://answers.microsoft.com/en-us/windows/forum/windows_7-performance/drag-and-drop-has-stopped-working-on-my-desk-top/68d886c2-028d-48e9-883d-59d101e30304

    It will be useful.

  • Drag-and - d├⌐poser gray?

    Hello

    For some reason the Drag and Drop option is grayed out. This could be because I work with the Responsive Design format in Captivate 8?

    Thank you

    In the first version of 8 slipped & was not possible, that it's in the second version. You can check the exact version number?

  • Drag-and - d├⌐poser disappear issue

    Hello, I do a game in which I have a little drag and drop elements they can be multiplied as much as you want. This items must stay in places and I also have a bin in the menu where if you drag them they should disappear. The problem is that I tried with several coordinates and they disappear in the scene in the moment that I am dragging them off the menu. So my question is:what could be the problem? The issue in the code?

    Thank you for taking the time to help me. This is my first game in AS3, so I'm not so familiar with the codes.

    import flash.display.Sprite;

    import flash.events.MouseEvent;

    DDB1.addEventListener (MouseEvent.MOUSE_DOWN, createDDB1);

    var _DDB1:Sprite;

    function createDDB1(evt:MouseEvent) {}

    _DDB1 = new DDB1MC();

    _DDB1.x = evt.stageX;

    _DDB1.y = evt.stageY;

    _DDB1.rotation = evt.currentTarget.rotation;

    _DDB1. Transform.ColorTransform = evt.currentTarget.transform.colorTransform

    addChild (_DDB1);

    _DDB1.StartDrag (false);

    _DDB1.addEventListener (MouseEvent.MOUSE_DOWN, dragDDB1);

    stage.addEventListener (MouseEvent.MOUSE_UP, dropDDB1);

    }

    function dragDDB1(evt:MouseEvent) {}

    evt.stopPropagation ();

    _DDB1 = evt.currentTarget as Sprite;

    _DDB1.StartDrag (false);

    stage.addEventListener (MouseEvent.MOUSE_UP, dropDDB1);

    }

    function dropDDB1(e:MouseEvent):void {}

    _DDB1.stopDrag ();

    stage.removeEventListener (MouseEvent.MOUSE_UP, dropDDB1);

    If (_DDB1.x > 700: _DDB1.x < 755 | < 240 _DDB1.y | _DDB1.y > 155) {}

    _DDB1. RemoveEventListener (MouseEvent.MOUSE_DOWN, dragDDB1);

    _DDB1.parent.removeChild (_DDB1);

    }

    _DDB1 = null;

    }

    Chances are that the problem lies in the following line:

    If (_DDB1.x > 700: _DDB1.x < 755="" ||="" _ddb1.y=""> < 240="" ||="" _ddb1.y=""> 155) {}

    Essentially, this line says if (the object is nowhere) due to the use of GOLD (|) operator.  If one of these things is true then the condition is satisfied, what becxause they overlap will always be true for at least two of them.  If this is supposed to restrict the object in an area you probably want to all of these terms to be satsified.  So in this case you must use the AND operator (and).

  • Is drag-and - d├⌐poser supported by TreeItem?

    Hello

    I am currently working with a JavaFx-2 TreeView representing a file system.

    I want to activate [drag and drop | http://docs.oracle.com/javafx/2/drag_drop/jfxpub-drag_drop.htm] to move operations, but it looks like TreeItem does not include slide event listeners. I was able to implement drag and drop on the TreeView encompassing, but it does not work for the sub-items.

    Am I missing something, or are drag and drop of events not taken in charge for the treeitem elements yet?

    Related SO question: http://stackoverflow.com/questions/11242847/is-drag-and-drop-supported-by-treeitem

    You must implement drag on drop on the TreeCell.

    Write a CellFactory like this:

    TreeView treeView = new TreeView();
            treeView.setCellFactory(new Callback, TreeCell>() {
                @Override
                public TreeCell call(TreeView stringTreeView) {
                    TreeCell treeCell = new TreeCell() {
                        protected void updateItem(String item, boolean empty) {
                            super.updateItem(item, empty);
                            if (item != null) {
                                setText(item);
                            }
                        }
                    };
    
                    treeCell.setOnDragDetected(new EventHandler() {
                        @Override
                        public void handle(MouseEvent mouseEvent) {
    
                        }
                    });
    
                    return treeCell;
                }
            });
    
  • Drag-and - d├⌐poser accept actions does not not in HTML5

    Hi all

    I'm testing features of captivate on mobile devices, more specifically iPads.

    I have a very simple drag and drop interaction implemented. It is a moving target, and 4 drag items on it.

    Drop targets accept methods are defined to hide items to move once they are dropped on the target. This works fine in preview mode, but carry no HTML5. I've included a photo to show the actions I put in place that do not work.

    Is there a way for them to work in HTML5?

    Screen Shot 2013-11-26 at 3.32.35 PM.png

    See you soon

    Lewis Carey

    Hello

    This is a bug present in HTML5 publish. As a can you please try to change the "opacity" to "0" and see that it resolves the problem.

    1. Select the drop target.

    2. in the control panel to Drag and Drop, Drop target section, change the value of 'Opacity' to '0'.

    3 publish the project.

    Let us know whether or not it solves the problem.

    Thank you

    VERALINE Sukumaran.

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

  • Custom button play/pause break drag-and - d├⌐poser? Captivate 9

    Hello

    I'm working on a sensitive project and everything was fine.

    But after I created a play/pause button custom fiscal drag - d├⌐poser has stopped working. The moveable objects appear but they can´t be dragged / cursor doesn´t change.

    Advanced reading action button simply checks to see if the project is paused (by changing the image on the play button) or else (change the button to another State and continuation of the project).

    How could this advanced break action slide it / move?

    Thanks for any help!

    A user variable must be created. You can give it a default value of 0 on creation. For the rest, you just use the same way you used the other buttons to toggle. For a user variable that it is you who decide what values it may have, you can set it is a Boolean value, but if you use the toggle command, it will automatically change the value of 1 if it is 0, or 0 if it is 1.

    You have seen the conditional action (Toggler) in this article.

    Most of the books and (certainly) Lynda tutorials are quite limited, sorry to say.

  • DataControl drag-and - d├⌐poser - parameter of method return problem! ******

    Hello

    This is a fundamental question of DataControl where I am facing some problems because of this.

    I created the form java webservice DataControl and using this CD in my application of ADF. When I do drag my RESULT of data control in my UI and select a specific output structure (Table or form or etc.), it's pop - up window with all the settings back where I can enter lables and hit the OK button.

    Pressing OK button a few times it's pop up the next window where I can see the name of DataControl on top and the parameters of input method list at the bottom of the window and I can enter the value of my input fields. But very shortly, I get this popup window 2. Not every time where after, press the OK button in the first window directly, is create the table / form in the user interface.

    But I need to this 2nd window or popup inorder to postpone my mandatory in all of my request input parameters. Please help me why I do not get this list of input methods sometimes. Or is there any other file I can change and set the input parameter binding method? It's really useful to solve one of my large project problem. Help please...

    Thank you
    klogube

    Hello

    Right-click on your jspx and open the pagedef for the page.

    In the pagedef, select the methodAction and edit (pencil icon), where you can specify values for the parameters of the method.

    HTH.

    Arun-

Maybe you are looking for