Posted By

visualadvance on 05/20/10


Tagged

mouse movieclip as3


Versions (?)

Who likes this?

7 people have marked this snippet as a favorite

adrianparr
Mephysto
socialflasher
tspitzr
rydaly
liakwee
meekgeek


AS3: Trace MovieClips Under Mouse


 / Published in: ActionScript 3
 

URL: http://www.bigspaceship.com/blog/labs/snaring-mouseenabled/

This is a handly little snippet from Big Spaceship. It will show you (on click) what movieclips are under your mouse. This is handy for those times when something is blocking a mouse action and you need to see what is under your mouse.

  1. import flash.geom.Point;
  2. stage.addEventListener (MouseEvent.CLICK, _checkMouseEventTrail, false, 0, true);
  3. private function _checkMouseEventTrail ($e:MouseEvent):void
  4. {
  5.  
  6. var pt:Point = new Point (mouseX, mouseY);
  7. var objects:Array = this.getObjectsUnderPoint (pt);
  8. for (var i:int = 0; i< objects.length; i++)
  9. {
  10. trace(">>", objects[i].name,": ",objects[i]);
  11. }
  12.  
  13. var p:* = $e.target;
  14. while (p)
  15. {
  16. trace(">>", p.name,": ",p);
  17. p = p.parent;
  18. }
  19. };

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: geodeath on March 23, 2012

fucking excellent snippet. Helped me pinpoint wtf was going on with something that changed my cursor to pointer... thumbs up man!

You need to login to post a comment.