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 x and y parameters. If you call this constructor function without parameters, a rectangle with x, y, width, and height properties set to 0 is created.

Availability: ActionScript 1.0; Flash Player 8

Parameters

x:Number - The x coordinate of the top-left corner of the rectangle.

y:Number - The y coordinate of the top-left corner of the rectangle.

width:Number - The width of the rectangle in pixels.

height:Number - The height of the rectangle in pixels.

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), y (Rectangle.y property), width (Rectangle.width property), height (Rectangle.height property)


Flash CS3