Add mouse listener to state : MouseEvent : Development Flash / Flex / ActionScript examples


Flash / Flex / ActionScript examples » Development » MouseEvent »

 

Add mouse listener to state


 

package {
  import flash.display.*;
  import flash.events.*;
  public class GetChildAtExample extends Sprite {
    public function GetChildAtExample(  ) {
   
      var color:Array = 0xFF00000x9900000x6600000x00FF00,
                          0x0099000x0066000x0000FF0x000099,
                          0x0000660xCCCCCC ];
   
      for var i:int 0; i < 10; i++ ) {
        var circle:Shape = createCirclecolor[i]10 );
        circle.x = i;
        circle.y = i + 10// the + 10 adds padding from the top
        
        addChildcircle );
      }      
      
      stage.addEventListenerMouseEvent.CLICK, updateDisplay );
    }
   
    public function updateDisplayevent:MouseEvent ):void {
      setChildIndexgetChildAt(0), numChildren - );
    }
    
    public function createCirclecolor:uint, radius:Number ):Shape {
      var shape:Shape = new Shape(  );
      shape.graphics.beginFillcolor );
      shape.graphics.drawCircle00, radius );
      shape.graphics.endFill(  );
      return shape;
    }
  }
}
                          

        



Leave a Comment / Note


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


Flash / Flex / ActionScript examples

 Navioo Development
» MouseEvent