Object | +-flash.geom.Rectangle public class Rectangle extends Object The Rectangle class is used to create and modify Rectangle objects. A Rectangle object is an area defined by its position, as indicated by its top-left corner point (x, y), and by its width and its height. Be careful when you design these areas if a rectangle is described as having its upper-left corner at 0,0 and has a height of 10 and a width of 20, the lower-right corner is at 9,19, because the count of width and height began at 0,0. The x, y, width, and height properties of the Rectangle class are independent of each other; changing the value of one property has no effect on the others. However, the right and bottom properties are integrally related to those four if you change right, you are changing width; if you change bottom, you are changing height, and so on. And you must have the left or x property established before you set width or right property. Rectangle objects are used to support the BitmapData class filters. They are also used in the MovieClip.scrollRect property to support the ability to crop and scroll a MovieClip instance with specific width, height and scrolling offsets. Availability: ActionScript 1.0; Flash Player 8 See also scrollRect (MovieClip.scrollRect property) Property summary
Properties inherited from class Object
Constructor summary
Method summary
Methods inherited from class Object
bottom (Rectangle.bottom property)public bottom : Number The sum of the y and height properties.
Availability: ActionScript 1.0; Flash Player 8 Example The following example creates a Rectangle object and changes the value of its bottom property from 15 to 30. Notice that the value of rect.height is also changed, from 10 to 25. import flash.geom.Rectangle; var rect:Rectangle = new Rectangle(5, 5, 10, 10); trace(rect.height); // 10 trace(rect.bottom); // 15 rect.bottom = 30; trace(rect.height); // 25 trace(rect.bottom); // 30 See also y (Rectangle.y property), height (Rectangle.height property) bottomRight (Rectangle.bottomRight property)public bottomRight : Point The location of the Rectangle object's bottom-right corner, determined by the values of the x and y properties.
Availability: ActionScript 1.0; Flash Player 8 Example The following example sets the Rectangle object's bottomRight property using the values of the Point object. Notice that rect.width and rect.height are changed. import flash.geom.Rectangle; import flash.geom.Point; var rect:Rectangle = new Rectangle(1, 2, 4, 8); trace(rect.bottom); // 10 trace(rect.right); // 5 trace(rect.height); // 8 trace(rect.width); // 4 var myBottomRight:Point = new Point(16, 32); rect.bottomRight = myBottomRight; trace(rect.bottom); // 32 trace(rect.right); // 16 trace(rect.height); // 30 trace(rect.width); // 15 See also Point (flash.geom.Point) clone (Rectangle.clone method)public clone() : Rectangle Returns a new Rectangle object with the same values for the x, y, width, and height properties as the original Rectangle object. Availability: ActionScript 1.0; Flash Player 8 Returns flash.geom.Rectangle - A new Rectangle object with the same values for the x, y, width, and height properties as the original Rectangle object. Example The following example creates three Rectangle objects and compares them. rect_1 is created using the Rectangle constructor. rect_2 is created by setting it equal to rect_1. And, clonedRect is created by cloning rect_1. Notice that while rect_2 evaluates as being equal to rect_1, clonedRect, even though it contains the same values as rect_1, does not. import flash.geom.Rectangle; var rect_1:Rectangle = new Rectangle(1, 2, 4, 8); var rect_2:Rectangle = rect_1; var clonedRect:Rectangle = rect_1.clone(); trace(rect_1 == rect_2); // true trace(rect_1 == clonedFilter); // false for(var i in rect_1) { trace(">> " + i + ": " + rect_1[i]); >> toString: [type Function] >> equals: [type Function] >> union: [type Function] >> intersects: [type Function] >> intersection: [type Function] >> containsRectangle: [type Function] >> containsPoint: [type Function] >> contains: [type Function] >> offsetPoint: [type Function] >> offset: [type Function] >> inflatePoint: [type Function] >> inflate: [type Function] >> size: (x=4, y=8) >> bottomRight: (x=5, y=10) >> topLeft: (x=1, y=2) >> bottom: 10 >> top: 2 >> right: 5 >> left: 1 >> isEmpty: [type Function] >> setEmpty: [type Function] >> clone: [type Function] >> height: 8 >> width: 4 >> y: 2 >> x: 1 } for(var i in clonedRect) { trace(">> " + i + ": " + clonedRect[i]); >> toString: [type Function] >> equals: [type Function] >> union: [type Function] >> intersects: [type Function] >> intersection: [type Function] >> containsRectangle: [type Function] >> containsPoint: [type Function] >> contains: [type Function] >> offsetPoint: [type Function] >> offset: [type Function] >> inflatePoint: [type Function] >> inflate: [type Function] >> size: (x=4, y=8) >> bottomRight: (x=5, y=10) >> topLeft: (x=1, y=2) >> bottom: 10 >> top: 2 >> right: 5 >> left: 1 >> isEmpty: [type Function] >> setEmpty: [type Function] >> clone: [type Function] >> height: 8 >> width: 4 >> y: 2 >> x: 1 } To further demonstrate the relationships between rect_1, rect_2, and clonedRect the example below modifies the x property of rect_1. Modifying x demonstrates that the clone() method creates a new instance based on values of the rect_1 instead of pointing to them in reference. import flash.geom.Rectangle; var rect_1:Rectangle = new Rectangle(1, 2, 4, 8); var rect_2:Rectangle = rect_1; var clonedRect:Rectangle = rect_1.clone(); trace(rect_1.x); // 1 trace(rect_2.x); // 1 trace(clonedRect.x); // 1 rect_1.x = 10; trace(rect_1.x); // 10 trace(rect_2.x); // 10 trace(clonedRect.x); // 1 See also x (Rectangle.x property), y (Rectangle.y property), width (Rectangle.width property), height (Rectangle.height property) contains (Rectangle.contains method)public contains(x:Number, y:Number) : Boolean Determines whether the specified point is contained within the rectangular region defined by this Rectangle object. Availability: ActionScript 1.0; Flash Player 8 Parameters x:Number - The x-value (horizontal position) of the point. y:Number - The y-value (vertical position) of the point. Returns Boolean - If the specified point is contained in the Rectangle object, returns true; otherwise false. Example The following example creates a Rectangle object and tests whether each of three coordinate pairs falls within its boundaries. import flash.geom.Rectangle; var rect:Rectangle = new Rectangle(10, 10, 50, 50); trace(rect.contains(59, 59)); // true trace(rect.contains(10, 10)); // true trace(rect.contains(60, 60)); // false See also Point (flash.geom.Point) containsPoint (Rectangle.containsPoint method)public containsPoint(pt:Point) : Boolean Determines whether the specified point is contained within the rectangular region defined by this Rectangle object. This method is similar to the Rectangle.contains() method, except that it takes a Point object as a parameter. Availability: ActionScript 1.0; Flash Player 8 Parameters pt:flash.geom.Point - The point, as represented by its x,y values. Returns Boolean - If the specified point is contained within this Rectangle object, returns TRue; otherwise false. Example The following example creates a Rectangle object and three Point objects, and tests whether each of the points falls within the boundaries of the rectangle. import flash.geom.Rectangle; import flash.geom.Point; var rect:Rectangle = new Rectangle(10, 10, 50, 50); trace(rect.containsPoint(new Point(10, 10))); // true trace(rect.containsPoint(new Point(59, 59))); // true trace(rect.containsPoint(new Point(60, 60))); // false See also contains (Rectangle.contains method), Point (flash.geom.Point) containsRectangle (Rectangle.containsRectangle method)public containsRectangle(rect:Rectangle) : Boolean Determines whether the Rectangle object specified by the rect parameter is contained within this Rectangle object. A Rectangle object is said to contain another if the second Rectangle object falls entirely within the boundaries of the first. Availability: ActionScript 1.0; Flash Player 8 Parameters rect:flash.geom.Rectangle - The Rectangle object being checked. Returns Boolean - If the Rectangle object that you specify is contained by this Rectangle object, returns true; otherwise false. Example The following example creates four new Rectangle objects and determines whether rectangle A contains rectangle B, C, or D. import flash.geom.Rectangle; var rectA:Rectangle = new Rectangle(10, 10, 50, 50); var rectB:Rectangle = new Rectangle(10, 10, 50, 50); var rectC:Rectangle = new Rectangle(10, 10, 51, 51); var rectD:Rectangle = new Rectangle(15, 15, 45, 45); trace(rectA.containsRectangle(rectB)); // true trace(rectA.containsRectangle(rectC)); // false trace(rectA.containsRectangle(rectD)); // true equals (Rectangle.equals method)public equals(toCompare:Object) : Boolean Determines whether the object specified in the toCompare parameter is equal to this Rectangle object. This method compares the x, y, width, and height properties of an object against the same properties of this Rectangle object. Availability: ActionScript 1.0; Flash Player 8 Parameters toCompare:Object - The rectangle to compare to this Rectangle object. Returns Boolean - If the object has exactly the same values for the x, y, width, and height properties as this Rectangle object, returns true; otherwise false. Example In the following example, rect_1 and rect_2 are equal, but rect_3 is not equal to the other two objects because its x, y, width, and height properties are not equal to those of rect_1 and rect_2. import flash.geom.Rectangle; var rect_1:Rectangle = new Rectangle(0, 0, 50, 100); var rect_2:Rectangle = new Rectangle(0, 0, 50, 100); var rect_3:Rectangle = new Rectangle(10, 10, 60, 110); trace(rect_1.equals(rect_2)); // true; trace(rect_1.equals(rect_3)); // false; Even though the method signature expects only an abstract object, only other Rectangle instances are treated as equal. import flash.geom.Rectangle; var rect_1:Rectangle = new Rectangle(0, 0, 50, 100); var nonRect:Object = new Object(); nonRect.x = 0; nonRect.y = 0; nonRect.width = 50; nonRect.height = 100; trace(rect_1.equals(nonRect)); See also x (Rectangle.x property), y (Rectangle.y property), width (Rectangle.width property), height (Rectangle.height property) height (Rectangle.height property)public height : Number The height of the rectangle in pixels. Changing the height value of a Rectangle object has no effect on the x, y, and width properties.
Availability: ActionScript 1.0; Flash Player 8 Example The following example creates a Rectangle object and changes its height property from 10 to 20. Notice that rect.bottom is also changed. import flash.geom.Rectangle; 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; 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) inflatePoint (Rectangle.inflatePoint method)public inflatePoint(pt:Point) : Void Increases the size of the Rectangle object. This method is similar to the Rectangle.inflate() method, except that it takes a Point object as a parameter. The following two code examples give the same result: rect1 = new flash.geom.Rectangle(0,0,2,5); rect1.inflate(2,2) rect1 = new flash.geom.Rectangle(0,0,2,5); pt1 = new flash.geom.Point(2,2); rect1.inflatePoint(pt1) Availability: ActionScript 1.0; Flash Player 8 Parameters pt:flash.geom.Point - Increases the rectangle by the x and y coordinate values of the point. Example The following example creates a Rectangle object and inflates it by the x (horizontal) and y (vertical) amounts found in a point. import flash.geom.Rectangle; import flash.geom.Point; var rect:Rectangle = new Rectangle(0, 0, 2, 5); trace(rect.toString()); // (x=0, y=0, w=2, h=5 var myPoint:Point = new Point(2, 2); rect.inflatePoint(myPoint); trace(rect.toString()); // (x=-2, y=-2, w=6, h=9) See also Point (flash.geom.Point) intersection (Rectangle.intersection method)public intersection(toIntersect:Rectangle) : Rectangle If the Rectangle object specified in the toIntersect parameter intersects with this Rectangle object, the intersection() method returns the area of intersection as a Rectangle object. If the rectangles do not intersect, this method returns an empty Rectangle object with its properties set to 0.
Availability: ActionScript 1.0; Flash Player 8 Parameters toIntersect:flash.geom.Rectangle - The Rectangle object to compare against to see if it intersects with this Rectangle object. Returns flash.geom.Rectangle - A Rectangle object that equals the area of intersection. If the rectangles do not intersect, this method returns an empty Rectangle object; that is, a rectangle with its x, y, width, and height properties set to 0. Example The following example determines the area where rect_1 intersects rect_2. import flash.geom.Rectangle; var rect_1:Rectangle = new Rectangle(0, 0, 50, 50); var rect_2:Rectangle = new Rectangle(25, 25, 100, 100); var intersectingArea:Rectangle = rect_1.intersection(rect_2); trace(intersectingArea.toString()); // (x=25, y=25, w=25, h=25) intersects (Rectangle.intersects method)public intersects(toIntersect:Rectangle) : Boolean Determines whether the object specified in the toIntersect parameter intersects with this Rectangle object. This method checks the x, y, width, and height properties of the specified Rectangle object to see if it intersects with this Rectangle object. Availability: ActionScript 1.0; Flash Player 8 Parameters toIntersect:flash.geom.Rectangle - The Rectangle object to compare against this Rectangle object. Returns Boolean - If the specified object intersects with this Rectangle object, returns TRue; otherwise false. Example The following example determines whether rectA intersects with rectB or rectC. import flash.geom.Rectangle; var rectA:Rectangle = new Rectangle(10, 10, 50, 50); var rectB:Rectangle = new Rectangle(59, 59, 50, 50); var rectC:Rectangle = new Rectangle(60, 60, 50, 50); var rectAIntersectsB:Boolean = rectA.intersects(rectB); var rectAIntersectsC:Boolean = rectA.intersects(rectC); trace(rectAIntersectsB); // true trace(rectAIntersectsC); // false var firstPixel:Rectangle = new Rectangle(0, 0, 1, 1); var adjacentPixel:Rectangle = new Rectangle(1, 1, 1, 1); var pixelsIntersect:Boolean = firstPixel.intersects(adjacentPixel); trace(pixelsIntersect); // false See also x (Rectangle.x property), y (Rectangle.y property), width (Rectangle.width property), height (Rectangle.height property) isEmpty (Rectangle.isEmpty method)public isEmpty() : Boolean Determines whether or not this Rectangle object is empty. Availability: ActionScript 1.0; Flash Player 8 Returns Boolean - If the Rectangle object's width or height is less than or equal to 0, returns true; otherwise false. Example The following example creates an empty Rectangle object and verifies that it is empty. import flash.geom.*; var rect:Rectangle = new Rectangle(1, 2, 0, 0); trace(rect.toString()); // (x=1, y=2, w=0, h=0) trace(rect.isEmpty()); // true The following example creates a non-empty Rectangle and makes it become empty. import flash.geom.Rectangle; var rect:Rectangle = new Rectangle(1, 2, 4, 8); trace(rect.isEmpty()); // false rect.width = 0; trace(rect.isEmpty()); // true rect.width = 4; trace(rect.isEmpty()); // false rect.height = 0; trace(rect.isEmpty()); // true left (Rectangle.left property)public left : Number The x coordinate of the top-left corner of the rectangle. Changing the x value of a Rectangle object has no effect on the y, width, and height properties. The left property is equal to the x property.
Availability: ActionScript 1.0; Flash Player 8 Example The following example changes the left property from 0 to 10. Notice that rect.x also changes. import flash.geom.Rectangle; var rect:Rectangle = new Rectangle(); trace(rect.left); // 0 trace(rect.x); // 0 rect.left = 10; trace(rect.left); // 10 trace(rect.x); // 10 See also x (Rectangle.x property), y (Rectangle.y property), width (Rectangle.width property), height (Rectangle.height property) offset (Rectangle.offset method)public offset(dx:Number, dy:Number) : Void Adjusts the location of the Rectangle object, as determined by its top-left corner, by the specified amounts. Availability: ActionScript 1.0; Flash Player 8 Parameters dx:Number - Moves the x value of the Rectangle object by this amount. dy:Number - Moves the y value of the Rectangle object by this amount. Example The following example creates a Rectangle object and offsets its x and y values by 5 and 10 respectively 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.offset(16, 32); trace(rect.toString()); // (x=17, y=34, w=4, h=8) offsetPoint (Rectangle.offsetPoint method)public offsetPoint(pt:Point) : Void Adjusts the location of the Rectangle object using a Point object as a parameter. This method is similar to the Rectangle.offset() method, except that it takes a Point object as a parameter. Availability: ActionScript 1.0; Flash Player 8 Parameters pt:flash.geom.Point - A Point object to use to offset this Rectangle object. 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 constructorpublic 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) right (Rectangle.right property)public right : Number The sum of the x and width properties.
Availability: ActionScript 1.0; Flash Player 8 Example The following example creates a Rectangle object and changes its right property from 15 to 30. Notice that rect.width also changes. import flash.geom.Rectangle; var rect:Rectangle = new Rectangle(5, 5, 10, 10); trace(rect.width); // 10 trace(rect.right); // 15 rect.right = 30; trace(rect.width); // 25 trace(rect.right); // 30 See also x (Rectangle.x property), width (Rectangle.width property) setEmpty (Rectangle.setEmpty method)public setEmpty() : Void Sets all of the Rectangle object's properties to 0. A Rectangle object is empty if its width or height is less than or equal to 0. This method sets the values of the x, y, width, and height properties to 0. Availability: ActionScript 1.0; Flash Player 8 Example The following example creates a non-empty Rectangle object and makes it empty. import flash.geom.Rectangle; var rect:Rectangle = new Rectangle(5, 10, 50, 100); trace(rect.isEmpty()); // false rect.setEmpty(); trace(rect.isEmpty()); // true See also x (Rectangle.x property), y (Rectangle.y property), width (Rectangle.width property), height (Rectangle.height property) size (Rectangle.size property)public size : Point The size of the Rectangle object, expressed as a Point object with the values of the width and height properties. Availability: ActionScript 1.0; Flash Player 8 Example The following example creates a Rectangle object, retrieves its size (size), changes its size (size), and sets the new values on the Rectangle object. It is important to remember that the Point object used by the size property uses x and y values to represent the width and height properties of the Rectangle object. import flash.geom.Rectangle; import flash.geom.Point; var rect:Rectangle = new Rectangle(1, 2, 4, 8); var size:Point = rect.size; trace(size.x); // 4; trace(size.y); // 8; size.x = 16; size.y = 32; rect.size = size; trace(rect.x); // 1 trace(rect.y); // 2 trace(rect.width); // 16 trace(rect.height); // 32 See also Point (flash.geom.Point) top (Rectangle.top property)public top : Number The y coordinate of the top-left corner of the rectangle. Changing the value of the top property of a Rectangle object has no effect on the x, width, and height properties. The value of the top property is equal to the value of the y property.
Availability: ActionScript 1.0; Flash Player 8 Example This example changes the value of the top property from 0 to 10. Notice that rect.y also changes. import flash.geom.Rectangle; var rect:Rectangle = new Rectangle(); trace(rect.top); // 0 trace(rect.y); // 0 rect.top = 10; trace(rect.top); // 10 trace(rect.y); // 10 See also x (Rectangle.x property), y (Rectangle.y property), width (Rectangle.width property), height (Rectangle.height property) topLeft (Rectangle.topLeft property)public topLeft : Point The location of the Rectangle object's top-left corner determined by the x and y values of the point.
Availability: ActionScript 1.0; Flash Player 8 Example The following example sets the Rectangle object's topLeft property using the values in a Point object. Notice that rect.x and rect.y are changed. import flash.geom.Rectangle; import flash.geom.Point; var rect:Rectangle = new Rectangle(); trace(rect.left); // 0 trace(rect.top); // 0 trace(rect.x); // 0 trace(rect.y); // 0 var myTopLeft:Point = new Point(5, 15); rect.topLeft = myTopLeft; trace(rect.left); // 5 trace(rect.top); // 15 trace(rect.x); // 5 trace(rect.y); // 15 See also Point (flash.geom.Point), x (Rectangle.x property), y (Rectangle.y property) toString (Rectangle.toString method)public toString() : String Builds and returns a string that lists the horizontal and vertical positions and the width and height of the Rectangle object. Availability: ActionScript 1.0; Flash Player 8 Returns String - A string that lists the value of each of the following properties of the Rectangle object: x, y, width, and height. Example The following example concatenates a string representation of rect_1 with some helpful debugging text. import flash.geom.Rectangle; var rect_1:Rectangle = new Rectangle(0, 0, 50, 100); trace("Rectangle 1 : " + rect_1.toString()); // Rectangle 1 : (x=0, y=0, w=50, h=100) See also x (Rectangle.x property), y (Rectangle.y property), width (Rectangle.width property), height (Rectangle.height property) union (Rectangle.union method)public union(toUnion:Rectangle) : Rectangle Adds two rectangles together to create a new Rectangle object, by filling in the horizontal and vertical space between the two rectangles.
Availability: ActionScript 1.0; Flash Player 8 Parameters toUnion:flash.geom.Rectangle - A Rectangle object to add to this Rectangle object. Returns flash.geom.Rectangle - A new Rectangle object that is the union of the two rectangles. Example The following example creates a Rectangle object out of the union of two others. For example, consider a rectangle with properties x=20, y=50, width=60, and height=30 (20, 50, 60, 30), and a second rectangle with properties (150, 130, 50, 30). The union of these two rectangles is a larger rectangle that encompasses the two rectangles with the properties (20, 50, 180, 110). import flash.geom.Rectangle; var rect_1:Rectangle = new Rectangle(20, 50, 60, 30); var rect_2:Rectangle = new Rectangle(150, 130, 50, 30); var combined:Rectangle = rect_1.union(rect_2); trace(combined.toString()); // (x=20, y=50, w=180, h=110) width (Rectangle.width property)public width : Number The width of the rectangle in pixels. Changing the value of the width property of a Rectangle object has no effect on the x, y, and height properties.
Availability: ActionScript 1.0; Flash Player 8 Example The following example creates a Rectangle object and change its width property from 10 to 20. Notice that rect.right also changes. import flash.geom.Rectangle; var rect:Rectangle = new Rectangle(5, 5, 10, 10); trace(rect.width); // 10 trace(rect.right); // 15 rect.width = 20; trace(rect.width); // 20 trace(rect.right); // 25 See also x (Rectangle.x property), y (Rectangle.y property), height (Rectangle.height property) x (Rectangle.x property)public x : Number The x coordinate of the top-left corner of the rectangle. Changing the value of the x property of a Rectangle object has no effect on the y, width, and height properties. The x property is equal to the left property. Availability: ActionScript 1.0; Flash Player 8 Example The following example creates an empty Rectangle and sets its x property to 10. Notice that rect.left is also changed. import flash.geom.Rectangle; var rect:Rectangle = new Rectangle(); trace(rect.x); // 0 trace(rect.left); // 0 rect.x = 10; trace(rect.x); // 10 trace(rect.left); // 10 See also left (Rectangle.left property) y (Rectangle.y property)public y : Number The y coordinate of the top-left corner of the rectangle. Changing the value of the y property of a Rectangle object has no effect on the x, width, and height properties. The y property is equal to the top property. Availability: ActionScript 1.0; Flash Player 8 Example The following example creates an empty Rectangle and sets its y property to 10. Notice that rect.top is also changed. import flash.geom.Rectangle; var rect:Rectangle = new Rectangle(); trace(rect.y); // 0 trace(rect.top); // 0 rect.y = 10; trace(rect.y); // 10 trace(rect.top); // 10 See also x (Rectangle.x property), width (Rectangle.width property), height (Rectangle.height property), top (Rectangle.top property) |