Inflate (Rectangle.inflate Method) - MACROMEDIA FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE Reference

Actionscript 2.0 language reference
Table of Contents

Advertisement

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)
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
to the top and the bottom by the
Availability: ActionScript 1.0; Flash Player 8
Parameters
- The value to be added to the left and the right of the Rectangle object. The
dx:Number
following equation is used to calculate the new width and position of the rectangle:
x -= dx;
width += 2 * dx;
- The value to be added to the top and the bottom of the Rectangle object. The
dy:Number
following equation is used to calculate the new height and position of the rectangle.
y -= dy;
height += 2 * dy;
Example
The following example creates a Rectangle object and increases the value of its
by 16 * 2 (32) and of its
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)
,
y (Rectangle.y property)
value.
dy
property by 32 * 2 (64)
height
,
width (Rectangle.width
width
Rectangle (flash.geom.Rectangle)
value, and
dx
property
1041

Hide quick links:

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE and is the answer not in the manual?

This manual is also suitable for:

Flash 8

Table of Contents

Save PDF