| Package | pegas.geom |
| Class | public class Rectangle |
| Inheritance | Rectangle Dimension |
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.
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.
To used this class with a FP8 and > with flash.display.BitmapData class and other flash.classes you can use the method toFlash() to return a compatible reference of this object.
| Property | Defined by | ||
|---|---|---|---|
| bottom : Number
Returns the sum of the y and height properties.
| Rectangle | ||
| bottomLeft : Vector2
Returns the location of the Rectangle object's bottom-left corner, determined by the values of the x and y properties.
| Rectangle | ||
| bottomRight : Vector2
Returns the location of the Rectangle object's bottom-right corner, determined by the values of the x and y properties.
| Rectangle | ||
| center : Vector2
Returns the location of the Rectangle object's center, determined by the values of the x and y properties.
| Rectangle | ||
![]() | height : Number
Determinates the height value of this instance.
| Dimension | |
| left : Number
Returns the x coordinate of the top-left corner of the rectangle.
| Rectangle | ||
| right : Number [read-only]
Returns the sum of the x and width properties.
| Rectangle | ||
| size : Vector2
Returns the size of the Rectangle object, expressed as a Vector2 object with the values of the width and height properties.
| Rectangle | ||
| top : Number
Returns the y coordinate of the top-left corner of the rectangle.
| Rectangle | ||
| topLeft : Vector2
Returns the location of the Rectangle object's top-left corner determined by the x and y values of the point.
| Rectangle | ||
| topRight : Vector2
Returns the location of the Rectangle object's top-right corner determined by the x and y values of the point.
| Rectangle | ||
![]() | width : Number
Determinates the width value of this instance.
| Dimension | |
| x : Number
The x coordinate of the top-left corner of the rectangle.
| Rectangle | ||
| y : Number
The y coordinate of the top-left corner of the rectangle.
| Rectangle | ||
![]() | ZERO : Dimension
[static]
Defines the Dimension object with the width and height properties set to zero.
| Dimension | |
| Method | Defined by | ||
|---|---|---|---|
|
Rectangle(... arguments)
Creates a new Rectangle instance whose top-left corner is specified by the x and y parameters.
| Rectangle | ||
|
clone():*
Returns a new Rectangle object with the same values for the x, y, width, and height properties as the original Rectangle object.
| Rectangle | ||
|
compare(o1:*, o2:*):Number
[static]
Compares its two arguments for order.
| Rectangle | ||
|
containsCoordinate(x:Number, y:Number):Boolean
Determines whether the specified point is contained within the rectangular region defined by this Rectangle object.
| Rectangle | ||
|
containsRectangle(rec:Rectangle):Boolean
Determines whether the Rectangle object specified by the rect parameter is contained within this Rectangle object.
| Rectangle | ||
|
containsVector(vector:Vector2):Boolean
Determines whether the specified point is contained within the rectangular region defined by this Rectangle object.
| Rectangle | ||
![]() |
Decreases the size by s and return its self(this).
| Dimension | |
|
empty():void
Sets all of the Rectangle object's properties to 0.
| Rectangle | ||
|
equals(o:*):Boolean
Compares the specified object with this object for equality.
| Rectangle | ||
![]() |
Returns a new bounds with this size with a pos.
| Dimension | |
![]() |
Increases the size by s and return its self(this).
| Dimension | |
|
inflate(dx:Number, dy:Number):void
Increases the size of the Rectangle object by the specified amounts.
| Rectangle | ||
|
inflatePoint(vector:Vector2):void
Increases the size of the Rectangle object.
| 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.
| Rectangle | ||
|
isEmpty():Boolean
Determines whether or not this Rectangle object is empty.
| Rectangle | ||
|
offset(dx:Number, dy:Number):void
Adjusts the location of the Rectangle object, as determined by its top-left corner, by the specified amounts.
| Rectangle | ||
|
offsetPoint(vector:Vector2):void
Adjusts the location of the Rectangle object using a Point object as a parameter.
| Rectangle | ||
|
setRight(n:Number):void
Sets the sum of the x and width properties.
| Rectangle | ||
![]() |
setSize(w:Number, h:Number):void
Sets the size of this instance.
| Dimension | |
|
toFlash():Rectangle
Returns a
flash.geom.Rectangle reference of this Rectangle object. | Rectangle | ||
|
toObject():Object
Returns the Object representation of this object.
| Rectangle | ||
|
toSource(indent:int = 0):String
Returns the source code string representation of the object.
| Rectangle | ||
|
toString():String
Returns the string representation of the object.
| Rectangle | ||
|
Adds two rectangles together to create a new Rectangle object, by filling in the horizontal and vertical space between the two rectangles.
| Rectangle | ||
| bottom | property |
bottom:Number [read-write]Returns the sum of the y and height properties.
Implementation public function get bottom():Number
public function set bottom(value:Number):void
| bottomLeft | property |
bottomLeft:Vector2 [read-write]Returns the location of the Rectangle object's bottom-left corner, determined by the values of the x and y properties.
Implementation public function get bottomLeft():Vector2
public function set bottomLeft(value:Vector2):void
| bottomRight | property |
bottomRight:Vector2 [read-write]Returns the location of the Rectangle object's bottom-right corner, determined by the values of the x and y properties.
Implementation public function get bottomRight():Vector2
public function set bottomRight(value:Vector2):void
| center | property |
center:Vector2 [read-write]Returns the location of the Rectangle object's center, determined by the values of the x and y properties.
Implementation public function get center():Vector2
public function set center(value:Vector2):void
| left | property |
left:Number [read-write]Returns the x coordinate of the top-left corner of the rectangle.
Implementation public function get left():Number
public function set left(value:Number):void
| right | property |
right:Number [read-only]Returns the sum of the x and width properties.
Implementation public function get right():Number
| size | property |
size:Vector2 [read-write]Returns the size of the Rectangle object, expressed as a Vector2 object with the values of the width and height properties.
Implementation public function get size():Vector2
public function set size(value:Vector2):void
| top | property |
top:Number [read-write]Returns the y coordinate of the top-left corner of the rectangle.
Implementation public function get top():Number
public function set top(value:Number):void
| topLeft | property |
topLeft:Vector2 [read-write]Returns the location of the Rectangle object's top-left corner determined by the x and y values of the point.
Implementation public function get topLeft():Vector2
public function set topLeft(value:Vector2):void
| topRight | property |
topRight:Vector2 [read-write]Returns the location of the Rectangle object's top-right corner determined by the x and y values of the point.
Implementation public function get topRight():Vector2
public function set topRight(value:Vector2):void
| x | property |
public var x:NumberThe x coordinate of the top-left corner of the rectangle.
| y | property |
public var y:NumberThe y coordinate of the top-left corner of the rectangle.
| Rectangle | () | constructor |
public function Rectangle(... arguments)Creates a new Rectangle instance whose top-left corner is specified by the x and y parameters. If not arguments are passed-in the constructor an empty rectangle is created.
Parameters... arguments — The x coordinate of the top-left corner of the rectangle.
|
import pegas.geom.Rectangle;
var rec:Rectangle = new Rectangle(5, 10, 50, 100);
trace( "output : " + rec.toString() ); // output : (x:5,y:10,width:50,height:100)
| clone | () | method |
public override function clone():*Returns a new Rectangle object with the same values for the x, y, width, and height properties as the original Rectangle object.
Returns* — a new Rectangle object with the same values for the x, y, width, and height properties as the original Rectangle object.
|
| compare | () | method |
public static function compare(o1:*, o2:*):NumberCompares its two arguments for order.
Parameterso1:* — the first object to compare.
|
|
o2:* — the second object to compare.
|
Number —
|
— the arguments of the method must be Rectangle reference.
|
| containsCoordinate | () | method |
public function containsCoordinate(x:Number, y:Number):BooleanDetermines whether the specified point is contained within the rectangular region defined by this Rectangle object.
Parametersx:Number — The x coordinate to check.
|
|
y:Number — The y coordinate to check.
|
Boolean — true if the specified point is contained within the rectangular region defined by this Rectangle object.
|
| containsRectangle | () | method |
public function containsRectangle(rec:Rectangle):BooleanDetermines whether the Rectangle object specified by the rect parameter is contained within this Rectangle object.
Parametersrec:Rectangle |
Boolean — true if the specified Rectangle is contained within this Rectangle object.
|
| containsVector | () | method |
public function containsVector(vector:Vector2):BooleanDetermines whether the specified point is contained within the rectangular region defined by this Rectangle object.
Parametersvector:Vector2 — The Vector2 to check.
|
Boolean — true if the specified point is contained within the rectangular region defined by this Rectangle object.
|
| empty | () | method |
public function empty():voidSets all of the Rectangle object's properties to 0.
| equals | () | method |
public override function equals(o:*):BooleanCompares the specified object with this object for equality.
Parameterso:* |
Boolean — true if the the specified object is equal with this object.
|
| inflate | () | method |
public function inflate(dx:Number, dy:Number):voidIncreases the size of the Rectangle object by the specified amounts.
Parametersdx:Number |
|
dy:Number |
| inflatePoint | () | method |
public function inflatePoint(vector:Vector2):voidIncreases the size of the Rectangle object.
Parametersvector:Vector2 |
| intersection | () | method |
public function intersection(toIntersect:Rectangle):RectangleIf 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.
ParameterstoIntersect:Rectangle |
Rectangle |
| isEmpty | () | method |
public function isEmpty():BooleanDetermines whether or not this Rectangle object is empty.
ReturnsBoolean — true if the width and the height of the rectangle are empty (0).
|
| offset | () | method |
public function offset(dx:Number, dy:Number):voidAdjusts the location of the Rectangle object, as determined by its top-left corner, by the specified amounts.
Parametersdx:Number |
|
dy:Number |
| offsetPoint | () | method |
public function offsetPoint(vector:Vector2):voidAdjusts the location of the Rectangle object using a Point object as a parameter.
Parametersvector:Vector2 |
| setRight | () | method |
public function setRight(n:Number):voidSets the sum of the x and width properties.
Parametersn:Number |
| toFlash | () | method |
public function toFlash():Rectangle
Returns a flash.geom.Rectangle reference of this Rectangle object.
Rectangle — a flash.geom.Rectangle reference of this Rectangle object.
|
| toObject | () | method |
public override function toObject():ObjectReturns the Object representation of this object.
ReturnsObject — the Object representation of this object.
|
| toSource | () | method |
public override function toSource(indent:int = 0):StringReturns the source code string representation of the object.
Parametersindent:int (default = 0) |
String — the source code string representation of the object.
|
| toString | () | method |
public override function toString():StringReturns the string representation of the object.
ReturnsString — the string representation of the object.
|
| union | () | method |
public function union(toUnion:Rectangle):RectangleAdds two rectangles together to create a new Rectangle object, by filling in the horizontal and vertical space between the two rectangles.
ParameterstoUnion:Rectangle |
Rectangle |