Posted By

Winkyboy on 10/16/08


Tagged

actionscript mouse rollover onDragOver onDragOut


Versions (?)

AS2 onDragOver Functional Replacement


 / Published in: ActionScript
 

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

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.

  1. var isMouseDown:Boolean = false;
  2. this.onMouseDown = function() {
  3. isMouseDown = true;
  4. };
  5. this.onMouseUp = function() {
  6. isMouseDown = false;
  7. };
  8. this.onEnterFrame = function() {
  9. if (isMouseDown) {
  10. trace("mouse down");
  11. } else {
  12. trace("mouse up");
  13. }
  14. };

Report this snippet  

You need to login to post a comment.