Rectangle (flash.geom.Rectangle)
1041
var rect:Rectangle = new Rectangle(5, 5, 10, 10);
trace(rect.height); // 10
trace(rect.bottom); // 15
rect.height = 20;
trace(rect.height); // 20
trace(rect.bottom); // 25
See also
x (Rectangle.x property)
,
y (Rectangle.y property)
,
width (Rectangle.width
property)
inflate (Rectangle.inflate method)
public inflate(dx:Number, dy:Number) : Void
Increases the size of the Rectangle object by the specified amounts. The center point of the
Rectangle object stays the same, and its size increases to the left and right by the
dx
value, and
to the top and the bottom by the
dy
value.
Availability:
ActionScript 1.0; Flash Player 8
Parameters
dx
:Number
- The value to be added to the left and the right of the Rectangle object. The
following equation is used to calculate the new width and position of the rectangle:
x -= dx;
width += 2 * dx;
dy
:Number
- The value to be added to the top and the bottom of the Rectangle object. The
following equation is used to calculate the new height and position of the rectangle.
y -= dy;
= 2 * dy;
Example
The following example creates a Rectangle object and increases the value of its
width
property
by 16 * 2 (32) and of its
height
property by 32 * 2 (64)
import flash.geom.Rectangle;
var rect:Rectangle = new Rectangle(1, 2, 4, 8);
trace(rect.toString()); // (x=1, y=2, w=4, h=8)
rect.inflate(16, 32);
trace(rect.toString()); // (x=-15, y=-30, w=36, h=72)
Содержание FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE
Страница 1: ...ActionScript 2 0 Language Reference ...
Страница 1352: ...1352 ActionScript classes ...