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;
height += 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) 

See also

x (Rectangle.x property), y (Rectangle.y property)


Flash CS3


 

Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/flash/9.0/main/00002084.html