Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You could accomplish this based on a modification of OXMO456's suggestion. As you are concerned about the notifications based on it's position in the stage, and not neccessarily it's parent, you can simply cache and compare the 'global' coordinates, and fire when that changes.</p> <p>useful methods to know:</p> <p><a href="http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/display/DisplayObject.html#localToGlobal%28%29" rel="nofollow noreferrer">localToGlobal</a></p> <p><a href="http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/display/DisplayObject.html#globalToLocal%28%29" rel="nofollow noreferrer">globalToLocal</a></p> <pre><code>public class Example extends Sprite{ private var stagePoint:Point = new Point(0,0); override public function set x(value:Number):void{ super.x=value; if(stage != null){ var globalPoint:Point = this.parent.localToGlobal(new Point(x,y)); if(globalPoint.x != stagePoint.x){ stagePoint = globalPoint; dispatchEvent(new Event("move")); } } } override public function set y(value:Number):void{ super.y=value; if(stage != null){ var globalPoint:Point = this.parent.localToGlobal(new Point(x,y)); if(globalPoint.y != stagePoint.y){ stagePoint = globalPoint; dispatchEvent(new Event("move")); } } } } </code></pre> <p>EDIT: Oh wait, I think I mis-interpreted what you were asking, doh! I'll leave this up in case it's useful in some other way.</p> <p>Can you give some more detail about the problem you're trying to solve by doing this? That might help us zero in on a solution that will work without deal-breaking overhead (like a ton of registered event listeners or some such)</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload