13.08.2012 Views

ACTIONSCRIPT 3 Developer’s Guide en

ACTIONSCRIPT 3 Developer’s Guide en

ACTIONSCRIPT 3 Developer’s Guide en

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>ACTIONSCRIPT</strong> 3.0 DEVELOPER’S GUIDE<br />

Using the drawing API<br />

Point A single location in a coordinate space. In the 2-d coordinate system used in ActionScript, a point is defined by<br />

its location along the x axis and the y axis (the point’s coordinates).<br />

Quadratic Bézier curve A type of curve defined by a particular mathematical formula. In this type of curve, the shape<br />

of the curve is calculated based on the positions of the anchor points (the <strong>en</strong>d points of the curve) and a control point<br />

that defines the amount and direction of the curve.<br />

Scale The size of an object relative to its original size. Wh<strong>en</strong> used as a verb, to scale an object means to change its size<br />

by stretching or shrinking the object.<br />

Stroke The outline portion of a shape that has a line filled in with color, or the lines of an un-filled shape.<br />

Translate To change a point’s coordinates from one coordinate space to another.<br />

X axis The horizontal axis in the 2-d coordinate system used in ActionScript.<br />

Y axis The vertical axis in the 2-d coordinate system used in ActionScript.<br />

The Graphics class<br />

Flash Player 9 and later, Adobe AIR 1.0 and later<br />

Each Shape, Sprite, and MovieClip object has a graphics property, which is an instance of the Graphics class. The<br />

Graphics class includes properties and methods for drawing lines, fills, and shapes. If you want a display object to use<br />

solely as a canvas for drawing cont<strong>en</strong>t, you can use a Shape instance. A Shape instance will perform better than other<br />

display objects for drawing, because it doesn’t have the overhead of the additional functionality in the Sprite and<br />

MovieClip classes. If you want a display object on which you can draw graphical cont<strong>en</strong>t and also want that object to<br />

contain other display objects, you can use a Sprite instance. For more information on determining which display object<br />

to use for various tasks, see “Choosing a DisplayObject subclass” on page 172.<br />

Drawing lines and curves<br />

Flash Player 9 and later, Adobe AIR 1.0 and later<br />

All drawing that you do with a Graphics instance is based on basic drawing with lines and curves. Consequ<strong>en</strong>tly, all<br />

ActionScript drawing must be performed using the same series of steps:<br />

Define line and fill styles<br />

Set the initial drawing position<br />

Draw lines, curves, and shapes (optionally moving the drawing point)<br />

If necessary, finish creating a fill<br />

Last updated 6/6/2012<br />

222

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!