Adobe FLEX 2-PROGRAMMING ACTIONSCRIPT 3.0 Manual page 177

Programming actionscript 3.0
Table of Contents

Advertisement

The Graphics class includes the following methods for easily drawing simple shapes:
,
,
,
, and
drawCircle()
drawEllipse()
drawRect()
drawRoundRect()
. Before calling drawing methods, define the line style, fill, or both
drawRoundRectComplex()
by calling the
,
,
,
,
linestyle()
lineGradientStyle()
beginFill()
beginGradientFill()
or
method.
beginBitmapFill()
Use the Sprite class if you want to create a graphical object that is also a display object
container (to contain other display objects) but that does not require a timeline.
For example, the following Sprite object has a circle drawn with its
property, and it
graphics
has a TextField object in its child list:
var mySprite:Sprite = new Sprite();
mySprite.graphics.beginFill(0xFFCC00);
mySprite.graphics.drawCircle(30, 30, 30);
var label:TextField = new TextField();
label.text = "hello";
label.x = 20;
label.y = 20;
mySprite.addChild(label);
this.addChild(mySprite);
The graphics layer for a Sprite or MovieClip object always appears in back of the child display
objects of the Sprite or MovieClip. Also, the graphics layer does not appear in the child list of
the Sprite or MovieClip.
Basics for working with the core display classes
177

Advertisement

Table of Contents
loading

This manual is also suitable for:

Flex

Table of Contents