Example
The following example offsets a Rectangle by using the values found in a point.
import flash.geom.Rectangle;
import flash.geom.Point;
var rect:Rectangle = new Rectangle(1, 2, 4, 8);
trace(rect.toString()); // (x=1, y=2, w=4, h=8)
var myPoint:Point = new Point(16, 32);
rect.offsetPoint(myPoint);
trace(rect.toString()); // (x=17, y=34, w=4, h=8)
See also
Point (flash.geom.Point)
Rectangle constructor
public Rectangle(x:Number, y:Number, width:Number, height:Number)
Creates a new Rectangle object whose top-left corner is specified by the
you call this constructor function without parameters, a rectangle with
properties set to 0 is created.
height
Availability: ActionScript 1.0; Flash Player 8
Parameters
- The x coordinate of the top-left corner of the rectangle.
x:Number
- The y coordinate of the top-left corner of the rectangle.
y:Number
- The width of the rectangle in pixels.
width:Number
- The height of the rectangle in pixels.
height:Number
Example
The following example creates a Rectangle object with the specified parameters.
import flash.geom.Rectangle;
var rect:Rectangle = new Rectangle(5, 10, 50, 100);
trace(rect.toString()); // (x=5, y=10, w=50, h=100)
See also
x (Rectangle.x property)
,
property)
height (Rectangle.height property)
,
y (Rectangle.y property)
and
x
y
,
,
x
y
width
,
width (Rectangle.width
Rectangle (flash.geom.Rectangle)
parameters. If
, and
1047
Need help?
Do you have a question about the FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE and is the answer not in the manual?