Search code examples
actionscript-3flash-cs4

onDragOver for Actionscript 3.0


I am having a hell of a time getting a MovieClip to detect whether another MovieClip is being dragged over it in ActionScript 3.0? Does anyone know of a good implementation.

Thanks


Solution

  • You can also use DisplayObject.hitTestObject()

    movieClipOnStage.hitTestObject(movieClipYouAreDragging)
    

    If you do this on a loop while you are dragging (using an Event.ENTER_FRAME, Event.MOUSE_MOVE or a Timer event) you should be able to get the result you are after.