Example below draw circles on the panel background of your application.
Circles drawn and its properties like color, size and dimensions will
completely depend on you as here you are both the artist and the button operator.
The circle is not a default feature, the instructions for drawing a circle is
defined inside the Sprite class of flash.display package and so it has been imported in the
application. The Sprite class elements demands UIComponent platform. In the program, we
have used addChild function which is used by the UIComponents variable to call
the sprite class variable inside them.
In the program code, addChild function is been used by two components, first by an UIComponent variable regularObject to call the flash.Sprite variable circle inside it and second by a flex container Panel whose id is bond077, to call the UIComponent variable regularObject inside it.
In the program, a colorObject name variable is used which has value type Number.
Within the action script portion of file, two packages have been imported namely: flash.display and mx.core. This import is done to get Sprite and UIComponent classes instances. In the code, a geometrical figure is created and for creating this figure a Sprite type variable has been created. Now graphics feature of Sprite class provides two methods: beginFill() and drawCircle(). Among these methods the first one fills color in the figure and the second one creates the figure. Now the Sprite variable is called inside the UIComponent variable through addChild function and the UIComponent variable is called inside the panel container through the panel id. Here calling UIComponent variable inside the panel container means figures will form on the panel background.
Liked it! Share this Tutorial