Creating Custom Visual Classes : Circle « Graphics « Flash / Flex / ActionScript

Home
Flash / Flex / ActionScript
1.Animation
2.Array
3.Class
4.Data Type
5.Development
6.Function
7.Graphics
8.Language
9.Network
10.Regular Expressions
11.Statement
12.String
13.TextField
14.XML
Flash / Flex / ActionScript » Graphics » Circle 




Creating Custom Visual Classes
 

package {
  import flash.display.Sprite;
  import flash.display.Shape;  
  public class Main extends Sprite {
    public function Main(  ) {
      var red:Circle = new Circle0xFF000010 );
      red.x = 10;
      red.y = 20;
      var green:Circle = new Circle0x00FF0010 );
      green.x = 15;
      green.y = 25;
      var blue:Circle = new Circle0x0000FF10 );
      blue.x = 20;
      blue.y = 20;
        
      addChildred );
      addChildgreen );
      addChildblue );
    }
  }
}
class Circle extends flash.display.Shape {
  
    private var _color:uint;
    private var _radius:Number;
    
    public function Circlecolor:uint = 0x000000, radius:Number = 10 ) {
      _color = color;
      _radius = radius;
      
      draw(  );
    }
    
    private function draw(  ):void {
      graphics.beginFill_color );
      graphics.drawCircle00, _radius );
      graphics.endFill(  );
    }
  }

                           

        














Related examples in the same category
1.Create a circle shape
2.Create Rectangle and Circle
3.Fill a circle
4.Circle Clicker
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.