User Guide
Example: SpriteArranger 187
Example: SpriteArranger
The SpriteArranger example application builds upon the Geometric Shapes example
application described in Chapter 4 (see “Example: GeometricShapes” on page 148).
The SpriteArranger example application illustrates a number of concepts for dealing with
display objects:
■ Extending display object classes
■ Adding objects to the display list
■ Layering display objects and working with display object containers
■ Responding to display object events
■ Using properties and methods of display objects
The SpriteArranger application files can be found in the folder Examples/SpriteArranger. The
application consists of the following files:
File Description
SpriteArranger.mxml The main application file in MXML for Flex.
com/example/programmingas3/
SpriteArranger/CircleSprite.as
A class defining a type of Sprite object that renders
a circle onscreen.
com/example/programmingas3/
SpriteArranger/DrawingCanvas.as
A class defining the canvas, which is a display object
container that contains GeometricSprite objects.
com/example/programmingas3/
SpriteArranger/SquareSprite.as
A class defining a type of Sprite object that renders
a square onscreen.
com/example/programmingas3/
SpriteArranger/TriangleSprite.as
A class defining a type of Sprite object that renders
a triangle onscreen.
com/example/programmingas3/
SpriteArranger/GeometricSprite.as
A class that extends the Sprite object, used to
define an onscreen shape. The CircleSprite,
SquareSprite, and TriangleSprite each extend this
class.
com/example/programmingas3/
geometricshapes/IGeometricShape.as
The base interface defining methods to be
implemented by all geometric shape classes.
com/example/programmingas3/
geometricshapes/IPolygon.as
An interface defining methods to be implemented by
geometric shape classes that have multiple sides.
com/example/programmingas3/
geometricshapes/RegularPolygon.as
A type of geometric shape that has sides of equal
length postioned symmetrically around the shape’s
center.
com/example/programmingas3/
geometricshapes/Circle.as
A type of geometric shape that defines a circle.