Adobe FLEX 2-PROGRAMMING ACTIONSCRIPT 3.0 Manual page 149

Programming actionscript 3.0
Table of Contents

Advertisement

File
com/example/programmingas3/
geometricshapes/RegularPolygon.as
com/example/programmingas3/
geometricshapes/Circle.as
com/example/programmingas3/
geometricshapes/EquilateralTriangle.as
com/example/programmingas3/
geometricshapes/Square.as
com/example/programmingas3/
geometricshapes/
GeometricShapeFactory.as
Defining the GeometricShapes classes
The GeometricShapes application lets the user specify a type of geometric shape and a size. It
then responds with a description of the shape, its area, and distance around its perimeter.
The application user interface is trivial, including a few controls for selecting the type of
shape, setting the size, and displaying the description. The most interesting part of this
application is under the surface, in the structure of the classes and interfaces themselves.
This application deals with geometric shapes, but it doesn't display them graphically. It
provides a small library of classes and interfaces that will be reused in a later chapter's
"Example: SpriteArranger" on page
graphically and lets the user manipulate them, based on the class framework provided here in
the GeometricShapes application.
Description
A type of geometric shape that has sides of
equal length postioned symmetrically around
the shape's center.
A type of geometric shape that defines a circle.
A subclass of RegularPolygon that defines a
triangle with all sides the same length.
A subclass of RegularPolygon defining a
rectangle with all four sides the same length.
A class containing a factory method for creating
shapes given a shape type and size.
187. The Sprite Arranger example displays the shapes
Example: GeometricShapes
149

Advertisement

Table of Contents
loading

This manual is also suitable for:

Flex

Table of Contents