Return to Snippet

Revision: 8987
at October 16, 2008 10:55 by Winkyboy


Initial Code
var isMouseDown:Boolean = false;
this.onMouseDown = function() {
    isMouseDown = true;
};
this.onMouseUp = function() {
    isMouseDown = false;
};
this.onEnterFrame = function() {
    if (isMouseDown) {
        trace("mouse down");
    } else {
        trace("mouse up");
    }
};

Initial URL
http://www.actionscript.org/forums/showthread.php3?t=152993

Initial Description
Because onDragOver in AS2 doesn't really work, here is some script for actually detecting whether the mouse button is held down when rolling over something.  NOTE that for ideal usage, you will have to write some actual collision detection between the cursor (_xmouse /_ymouse) and whatever object(s) you wish to roll over.

Initial Title
AS2 onDragOver Functional Replacement

Initial Tags
actionscript

Initial Language
ActionScript