Mouse Event Hierarchy : MouseEvent : Development Flash / Flex / ActionScript examples


Flash / Flex / ActionScript examples » Development » MouseEvent »

 

Mouse Event Hierarchy


 
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(0x0000ff1);
        firstListener.graphics.drawCircle(00100);
        firstListener.graphics.endFill();

        secondListener.graphics.beginFill(0x00ff001);
        secondListener.graphics.drawCircle(0030);
        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 ");
    }
}
}

        



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


Flash / Flex / ActionScript examples

 Navioo Development
» MouseEvent