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 />

Display programming<br />

Core display classes<br />

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

The ActionScript 3.0 flash.display package includes classes for visual objects that can appear in Flash Player or AIR.<br />

The following illustration shows the subclass relationships of these core display object classes.<br />

AVM1Movie Bitmap InteractiveObject MorphShape Shape StaticText Video<br />

Loader<br />

DisplayObject<br />

DisplayObjectContainer SimpleButton TextField<br />

Sprite<br />

MovieClip<br />

Stage<br />

The illustration shows the class inheritance of display object classes. Note that some of these classes, specifically<br />

StaticText, TextField, and Video, are not in the flash.display package, but they still inherit from the DisplayObject class.<br />

All classes that ext<strong>en</strong>d the DisplayObject class inherit its methods and properties. For more information, see<br />

“Properties and methods of the DisplayObject class” on page 158.<br />

You can instantiate objects of the following classes contained in the flash.display package:<br />

Bitmap—You use the Bitmap class to define bitmap objects, either loaded from external files or r<strong>en</strong>dered through<br />

ActionScript. You can load bitmaps from external files through the Loader class. You can load GIF, JPG, or PNG<br />

files. You can also create a BitmapData object with custom data and th<strong>en</strong> create a Bitmap object that uses that data.<br />

You can use the methods of the BitmapData class to alter bitmaps, whether they are loaded or created in<br />

ActionScript. For more information, see “Loading display objects” on page 198 and “Working with bitmaps” on<br />

page 242.<br />

Loader—You use the Loader class to load external assets (either SWF files or graphics). For more information, see<br />

“Loading display cont<strong>en</strong>t dynamically” on page 198.<br />

Shape—You use the Shape class to create vector graphics, such as rectangles, lines, circles, and so on. For more<br />

information, see “Using the drawing API” on page 221.<br />

SimpleButton—A SimpleButton object is the ActionScript repres<strong>en</strong>tation of a button symbol created in the Flash<br />

authoring tool. A SimpleButton instance has four button states: up, down, over, and hit test (the area that responds<br />

to mouse and keyboard ev<strong>en</strong>ts).<br />

Sprite—A Sprite object can contain graphics of its own, and it can contain child display objects. (The Sprite class<br />

ext<strong>en</strong>ds the DisplayObjectContainer class). For more information, see “Working with display object containers” on<br />

page 159 and “Using the drawing API” on page 221.<br />

Last updated 6/6/2012<br />

154

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

Saved successfully!

Ooh no, something went wrong!