package
{
import flash.display.Sprite;
import flash.events.MouseEvent;
public class Main extends Sprite
{
private var firstListener:Sprite = new Sprite();
private var secondListener:Sprite = new Sprite();
public function Main(){
firstListener.graphics.beginFill(0x0000ff, 1);
firstListener.graphics.drawCircle(0, 0, 100);
firstListener.graphics.endFill();
secondListener.graphics.beginFill(0x00ff00, 1);
secondListener.graphics.drawCircle(0, 0, 30);
secondListener.graphics.endFill();
addChild(firstListener);
addChild(secondListener);
firstListener.y = 300;
secondListener.y = 250;
this.stage.addEventListener(MouseEvent.MOUSE_DOWN, mainMouseDown);
firstListener.addEventListener(MouseEvent.MOUSE_DOWN, firstMouseDown);
secondListener.addEventListener(MouseEvent.MOUSE_DOWN, secondMouseDown);
this.stage.addEventListener(MouseEvent.MOUSE_MOVE, mainMouseMove);
firstListener.addEventListener(MouseEvent.MOUSE_MOVE, firstMouseMove);
secondListener.addEventListener(MouseEvent.MOUSE_MOVE, secondMouseMove);
}
private function mainMouseMove(me:MouseEvent):void
{
trace(" stage move ");
}
private function firstMouseMove(me:MouseEvent):void
{
trace("first move ");
}
private function secondMouseMove(me:MouseEvent):void
{
trace("second move");
}
private function mainMouseDown(me:MouseEvent):void
{
trace(" stage down ");
}
private function firstMouseDown(me:MouseEvent):void
{
trace("first down ");
}
private function secondMouseDown(me:MouseEvent):void
{
trace("second down ");
}
}
}