Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var rectangle = new Sprite();
- rectangle.graphics,beginFill(0xff0000 ,1);
- rectangle.graphics.drawRect(0, 0, 100,50);
- rectangle.graphics.endFill();
- // rectangle added to the stage
- addchild(rectangle);
- var circle = new Sprite();
- circle.graphics.beginFill(0xff0000 ,1);
- circle.graphics.drawCircle(0, 0,50);
- circle.graphics.endFill();
- // circle added to the stage
- addchild(circle );
- // event listener added to the Stage
- // Note: event listener added to the container(stage) not to its children(circle, rectangle)
- addEventListener(MouseEvent.Click, onClick);
- public function onClick(event:MouseEvent):void{
- trace( event.target );
- trace( event.currentTarget );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement