EasyManua.ls Logo

MACROMEDIA FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE - Rectangle Constructor

MACROMEDIA FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE
1378 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Rectangle (flash.geom.Rectangle) 1047
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 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)

Table of Contents

Related product manuals