Local Global Sample
package
{
import flash.display.Sprite;
import flash.events.MouseEvent;
public class Main extends Sprite
{
public function Main()
{
this.stage.scaleMode = "noScale";
this.stage.align = "tl";
var localSprite:Sprite = new Sprite();
localSprite.graphics.beginFill(0x00ffCC, 1);
localSprite.graphics.drawCircle(0, 0, 50);
localSprite.graphics.endFill();
addChild(localSprite);
localSprite.x = 200;
localSprite.y = 200;
localSprite.addEventListener(MouseEvent.MOUSE_MOVE, moving);
}
private function moving(mouseEvent:MouseEvent):void
{
trace(' local ' + mouseEvent.localX + ' ' + mouseEvent.localY);
trace(' stage ' + mouseEvent.stageX + ' ' + mouseEvent.stageY);
}
}
}
Related examples in the same category