User Guide

417
15
CHAPTER 15
Working with Geometry
The flash.geom package contains classes that define geometric objects such as points,
rectangles, and transformation matrixes. You use these classes to define the properties of
objects that are used in other classes.
Contents
Using Point objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 417
Using Rectangle objects. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 420
Using Matrix objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .423
Example: Applying a matrix transformation to a display object . . . . . . . . . . . . . . . .428
Using Point objects
A Point object defines a Cartesian pair of coordinates. It represents location in a two-
dimensional coordinate system, where x represents the horizontal axis and y represents the
vertical axis.
To define a Point object, you set its
x and y properties, as follows:
import flash.geom.*;
var pt1:Point = new Point(10, 20); // x == 10; y == 20
var pt2:Point = new Point();
pt2.x = 10;
pt2.y = 20;