new Ellipse( [x] [, y] [, width] [, height])
The Ellipse object can be used to specify a hit area for displays.
The Ellipse object can be used to specify a hit area for displays.
A Ellipse 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.
Parameters:
Name | Type | Argument | Default | Description |
---|---|---|---|---|
x |
number |
<optional> |
0 | The x value of the object. |
y |
number |
<optional> |
0 | The y value of the object. |
width |
number |
<optional> |
0 | The width value of the object. |
height |
number |
<optional> |
0 | The height value of the object. |
Extends
Members
-
area :Number
-
The area of the ellipse.
Type:
- Number
- Default Value:
-
- 0
Example
var ellipse = new Ellipse( 40 , 12 ) ;trace( ellipse.area ) ;
-
bottom
-
The sum of the y and height properties.
-
center
-
The location of the Rectangle object's center.
-
centerX
-
Indicates the x coordinate of the Rectangle center.
-
centerY
-
Indicates the y coordinate of the Rectangle center.
-
height :Number
-
The height of the rectangle, in pixels.
Type:
- Number
- Inherited From:
- Default Value:
-
- 0
-
left
-
The x coordinate of the top-left corner of the rectangle.
-
right
-
The sum of the x and width properties.
-
top
-
The y coordinate of the top-left corner of the rectangle.
-
width :Number
-
The width of the rectangle, in pixels.
Type:
- Number
- Inherited From:
- Default Value:
-
- 0
Methods
-
centerOn(x, y)
-
Centers this
Rectangle
so that the center coordinates match the given x and y values.Parameters:
Name Type Description x
number The x coordinate to place the center of the Rectangle at.
y
number The y coordinate to place the center of the Rectangle at.
Returns:
The current reference of the object.
-
clone()
-
Returns a new Ellipse object with the same values for the x, y, width, and height properties as the original Ellipse object.
- Overrides:
Returns:
a shallow copy of the object.
-
contains(x, y)
-
Determines whether the specified point is contained within the ellipse region.
Parameters:
Name Type Description x
number The x position of the point to check.
y
number The y position of the point to check.
Returns:
true
if the specified point is contained within the ellipse region. -
copyFrom(obj)
-
Copies all of rectangle data from the source Rectangle object into the calling Rectangle object.
Parameters:
Name Type Description obj
graphics.geom.Ellipse | graphics.geom.Rectangle | Object The object to copy.
- Overrides:
-
decrease( [dWidth] [, dHeight])
-
Decreases the size by a specific width/height values and return its self(this).
Parameters:
Name Type Argument Default Description dWidth
number <optional>
0 A number value to descrease the width component of the object (default 0).
dHeight
number <optional>
0 A number value to descrease the height component of the object (default 0).
- Inherited From:
-
equals(toCompareThe [, strict])
-
Determines whether the object specified in the toCompare parameter is equal to this Rectangle object.
Parameters:
Name Type Argument Default Description toCompareThe
object object to evaluates.
strict
boolean <optional>
true If true the method accept only a toCompare Ellipse, else any object with the x, y, width and height properties.
- Overrides:
Returns:
true
if the the specified object is equal with this object.- Type
- boolean
-
getBounds()
-
Returns the
Rectangle
representation of the ellipse.Returns:
The
Rectangle
representation of the ellipse. -
increase( [dWidth] [, dHeight])
-
Increases the size by a specific width/height values and return its self(this).
Parameters:
Name Type Argument Default Description dWidth
number <optional>
0 A number value to increase the width component of the object (default 0).
dHeight
number <optional>
0 A number value to inscrease the height component of the object (default 0).
- Inherited From:
Returns:
the current reference of this object.
-
isEmpty()
-
Determines whether or not this Rectangle object is empty.
- Inherited From:
Returns:
A value of true if the Rectangle object's width or height is less than or equal to 0; otherwise false.
- Type
- boolean
-
setTo( [x] [, y] [, width] [, height])
-
Sets the members of the Ellipse to the specified values.
Parameters:
Name Type Argument Default Description x
number <optional>
0 The x coordinate of the top-left corner of the ellipse.
y
number <optional>
0 The y coordinate of the top-left corner of the ellipse.
width
number <optional>
0 The width of the ellipse, in pixels.
height
number <optional>
0 The height of the ellipse, in pixels.
- Overrides:
Returns:
The current object reference.
-
toObject()
-
Returns the Object representation of this object.
- Overrides:
Returns:
the Object representation of this object.
-
toString()
-
Returns the string representation of this instance.
- Overrides:
Returns:
the string representation of this instance.