Distinguishing Events Targeted at an Object from Events Targeted at That Object's Descendants : stage « Development « Flash / Flex / ActionScript






Distinguishing Events Targeted at an Object from Events Targeted at That Object's Descendants

 

package{
    import flash.display.GradientType;
    import flash.display.Sprite;
    import flash.geom.Matrix;
    import flash.events.*;  
    public class Main extends Sprite {
    
         public function Main() {
            stage.addEventListener(MouseEvent.CLICK, clickListener);
    
         }
        private function clickListener (e:MouseEvent):void {
          if (e.eventPhase == EventPhase.AT_TARGET) {
          }
        }
    }
}

        








Related examples in the same category

1.Setting the Frame Rate
2.Traversing Objects in a Display Hierarchy
3.Recursive display list tree traversal
4.responds to mouse clicks that occur over any object on the display list, but not over a vacant area of the Stage instance
5.A stretchy layout
6.Simple Scribble
7.Working with the Stage
8.Local Global Sample