I have a project with Flash Professional CS5 and ActionScript 3.
I need to trigger an event when I drag an object over a particular spot, but haven’t dropped it yet. Then, I need to trigger a different event when I leave that spot (still dragging). However, this should only occur while I am dragging on object.
The traditional mouse over and mouse leave events aren’t working while dragging (only while not dragging).
How do I do this?
The reason it’s not working is because the top DisplayObject (the one being dragged, is stealing the events for itself).
You have a few options, 1st is adding the MOUSE_MOVE event to the dragged object instead of the particular spot, and you could do a hitTestObject() to verify if they overlap, or a hitTestPoint() if the mouse is inside the particular spot.
So basically do this:
Second one is to disable mouse events for the dragged object with
mouseChildrenandmouseEnabledproperties, but that would break your current dragging, you would have to rearrange your events to the dragged object parent or the stage.