Friday, May 22, 2009

Create a circle by using the actionscripit

Hi

Today learned about how to draw a circle or line in mxml.Normally in flex there no circle component ,if we like to create a circle there is no such components in mxml.
By using action I am draw one circle by using actionscript.

It is the example to create a circle with color.....
within the scripit u code like this
import mx.controls.Alert;
import mx.core.UIComponent;
public function circle():void
{
var newcircle:Sprite=new Sprite();
newcircle.graphics.beginFill(0x000000,1);
newcircle.graphics.drawCircle(10,10,8);
newcircle.graphics.endFill();
var d:UIComponent=new UIComponent();
this.addChild(d);
d.addChild(newcircle);
}
*import the flash.
*Create the object as newcircle.
*Begin to draw a circle.
*Draw the with xposition 10,y position10,and then Draw with radius 8.
*create a variable to get the circle as component.
*By using addchild the object.

No comments:

Post a Comment