DisplayObject class abstract
The base class for all objects that can be placed on the display list.
Use the DisplayObjectContainer class to arrange the display objects in the display list. DisplayObjectContainer objects can have child display objects, while other display objects, such as Shape and TextField objects, are "leaf" nodes that have only parents and siblings, no children.
The DisplayObject class supports basic functionality like the x and y position of an object, as well as more advanced properties of the object such as its transformation matrix.
The DisplayObject class itself does not include any APIs for rendering
content onscreen. For that reason, if you want to create a custom subclass
of the DisplayObject class, you will want to extend one of its subclasses
that do have APIs for rendering content onscreen, such as the Shape,
Sprite, Bitmap, SimpleButton, TextField, or MovieClip
class.
The DisplayObject class contains several BroadcastEvents. Normally, the target of any particular event is a specific DisplayObject instance. For example, the target of an added event is the specific DisplayObject instance that was added to the display list. Having a single target restricts the placement of event listeners to that target and in some cases the target's ancestors on the display list. With BroadcastEvents, however, the target is not a specific DisplayObject instance, but rather all DisplayObject instances, including those that are not on the display list. This means that you can add a listener to any DisplayObject instance to listen for BroadcastEvents.
- Inheritance
-
- Object
- EventDispatcher
- DisplayObject
- Implemented types
- Implementers
Constructors
Properties
- alpha ↔ num
-
The alpha transparency value of the object specified.
getter/setter pairoverride
- blendMode ↔ BlendMode?
-
A value from the BlendMode class that specifies which blend mode to use.
getter/setter pairoverride-getter
-
bounds
→ Rectangle<
num> -
Returns a rectangle that defines the area of this display object in
this display object's local coordinates.
no setteroverride
-
boundsTransformed
→ Rectangle<
num> -
Returns a rectangle that defines the area of this display object in
this display object's parent coordinates.
no setter
- cache → RenderTextureQuad?
-
This getter gives you access to the underlying RenderTextureQuad if
a cache is applied to this display object. If no cache is applied this
value is ´null´.
no setteroverride
- displayObjectID → int
-
final
-
filters
↔ List<
BitmapFilter> -
The filters currently associated with this display object.
getter/setter pairoverride-getter
- globalTransformationMatrix → Matrix
-
The global 2D transformation matrix of this display object.
no setter
- globalTransformationMatrix3D → Matrix3D
-
The global 3D transformation matrix of this display object.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- height ↔ num
-
The height of this display object with the applied transformation.
getter/setter pair
- mask ↔ Mask?
-
The calling display object is masked by the specified mask object.
getter/setter pairoverride-getter
-
mousePosition
→ Point<
num> ? -
The position of the mouse relative to the local coordinate system of
the display object.
no setter
- mouseX → num
-
The x-coordinate of the mouse relative to the local coordinate system of
the display object.
no setter
- mouseY → num
-
The y-coordinate of the mouse relative to the local coordinate system of
the display object.
no setter
- name ↔ String
-
The instance name of this display object.
getter/setter pair
- off ↔ bool
-
The availability and visibility of the display object.
getter/setter pair
-
onAdded
→ EventStream<
Event> -
Dispatched when a display object is added to the display list.
no setter
-
onAddedToStage
→ EventStream<
Event> -
Dispatched when a display object is added to the on stage display list,
either directly or through the addition of a sub tree in which the display
object is contained.
no setter
-
onEnterFrame
→ EventStream<
EnterFrameEvent> -
Dispatched when a frame is entered.
no setter
-
onExitFrame
→ EventStream<
ExitFrameEvent> -
Dispatched when a frame is exited. All frame scripts have been run.
no setter
-
onRemoved
→ EventStream<
Event> -
Dispatched when a display object is about to be removed from the display
list.
no setter
-
onRemovedFromStage
→ EventStream<
Event> -
Dispatched when a display object is about to be removed from the display
list, either directly or through the removal of a sub tree in which the
display object is contained.
no setter
-
onRender
→ EventStream<
RenderEvent> -
Dispatched when the display list is about to be updated and rendered.
no setter
-
parent
→ DisplayObjectParent<
DisplayObject> ? -
The DisplayObjectContainer object that contains this display object.
no setter
- pivotX ↔ num
-
The x-coordinate of the pivot point of this display object.
getter/setter pairoverride
- pivotY ↔ num
-
The y-coordinate of the pivot point of this display object.
getter/setter pairoverride
- root → DisplayObject
-
The top-most display object in the portion of the display list's tree
structure.
no setter
- rotation ↔ num
-
The rotation of this display object, in radians, from its original
orientation.
getter/setter pairoverride
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- scaleX ↔ num
-
The horizontal scale (percentage) of the object as applied from the
pivot point.
getter/setter pairoverride
- scaleY ↔ num
-
The vertical scale (percentage) of the object as applied from the
pivot point.
getter/setter pairoverride
- skewX ↔ num
-
The horizontal skew of this object.
getter/setter pairoverride
- skewY ↔ num
-
The vertical skew of this object.
getter/setter pairoverride
- stage → Stage?
-
The Stage of this display object.
no setter
- transformationMatrix → Matrix
-
The transformation matrix of this display object relative to
this display object's parent.
no setteroverride
- userData ↔ dynamic
-
The user-defined data associated with this display object.
getter/setter pair
- visible ↔ bool
-
The visibility and availability of the display object.
getter/setter pair
- width ↔ num
-
The width of this display object with the applied transformation.
getter/setter pair
- x ↔ num
-
The x-coordinate of is display object relative to the
local coordinates of the parent DisplayObjectContainer.
getter/setter pairoverride
- y ↔ num
-
The y-coordinate of this display object relative to the
local coordinates of the parent DisplayObjectContainer.
getter/setter pairoverride
Methods
-
addEventListener<
T extends Event> (String eventType, EventListener< T> eventListener, {bool useCapture = false, int priority = 0}) → StreamSubscription<T> -
Adds an event listener to receive events.
inherited
-
addTo(
DisplayObjectParent< DisplayObject> parent) → void -
Add this display object to the specified
parent
. -
alignPivot(
[HorizontalAlign hAlign = HorizontalAlign.Center, VerticalAlign vAlign = VerticalAlign.Center]) → void - Aligns the display object's pivot point relative to the current bounds.
-
applyCache(
num x, num y, num width, num height, {bool debugBorder = false, num pixelRatio = 1.0}) → void - Draws the specified area of this display object to an internal render texture and the engine will use this texture to optimize performance.
-
dispatchEvent(
Event event) → void -
Dispatches the
event
to all listening subscribers.override -
dispatchEventRaw(
Event event, EventDispatcher target, EventPhase eventPhase) → void -
Do not use the dispatchEventRaw method unless you want to override the
way how events are dispatched for display list object. Please use
dispatchEvent instead.
inherited
-
getBounds(
DisplayObject targetSpace) → Rectangle< num> -
Returns the bounds of this display object relative to the specified
targetSpace
. -
getTransformationMatrix(
DisplayObject targetSpace) → Matrix -
The 2D transformation matrix relative to the given
targetSpace
. -
getTransformationMatrix3D(
DisplayObject targetSpace) → Matrix3D -
The 3D transformation matrix relative to the given
targetSpace
. -
globalToLocal(
Point< num> globalPoint, [Point<num> ? returnPoint]) → Point<num> - Converts the point object from the Stage's global coordinates to this display object's local coordinates.
-
hasEventListener(
String eventType, {bool useCapture = false}) → bool -
Returns true if the EventDispatcher has event listeners. The
useCapture
paramenter defines if the event listeners should be registered for the capturing event phase or not.inherited -
hitTestInput(
num localX, num localY) → DisplayObject? -
Evaluates this display object to see if the coordinates
localX
andlocalY
are inside this display object. -
hitTestObject(
DisplayObject other) → bool -
Evaluates this display object to see if it overlaps or intersects with
the bounding box of the
other
display object. -
hitTestPoint(
num x, num y, [bool shapeFlag = false]) → bool -
Evaluates this display object to see if it overlaps or intersects with
the point specified by the
x
andy
parameters. -
localToGlobal(
Point< num> localPoint, [Point<num> ? returnPoint]) → Point<num> - Converts the point object from this display object's local coordinates to the Stage global coordinates.
-
localToParent(
Point< num> localPoint, [Point<num> ? returnPoint]) → Point<num> - Converts the point object from this display object's local coordinates to this display object's parent coordinates.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
on<
T extends Event> (String eventType) → EventStream< T> -
Returns an event stream of type
eventType
.inherited -
parentToLocal(
Point< num> parentPoint, [Point<num> ? returnPoint]) → Point<num> - Converts the point object from this display object's parent coordinates to this display object's local coordinates.
-
refreshCache(
) → void - Refreshes the cached area of this display object.
-
removeCache(
) → void - Removes the previously cached area of this display object.
-
removeEventListener<
T extends Event> (String eventType, EventListener< T> eventListener, {bool useCapture = false}) → void -
Removes an event listener to stop receiving events.
inherited
-
removeEventListeners(
String eventType) → void -
Removes all event listeners of a given event type.
inherited
-
removeFromParent(
) → void - Removes this display object from its parent.
-
render(
RenderState renderState) → void -
Renders this display object with the given
renderState
. The display object is rendered without its filters.override -
renderFiltered(
RenderState renderState) → void -
Renders this display object with the given
renderState
. The display object is rendered with its filters.override -
setTransform(
num x, num y, [num scaleX = 1, num scaleY = 1, num rotation = 0, num skewX = 0, num skewY = 0, num pivotX = 0, num pivotY = 0]) → void - Sets transformation properties.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Constants
-
addedEvent
→ const EventStreamProvider<
Event> -
addedToStageEvent
→ const EventStreamProvider<
Event> -
enterFrameEvent
→ const EventStreamProvider<
EnterFrameEvent> -
exitFrameEvent
→ const EventStreamProvider<
ExitFrameEvent> -
removedEvent
→ const EventStreamProvider<
Event> -
removedFromStageEvent
→ const EventStreamProvider<
Event> -
renderEvent
→ const EventStreamProvider<
RenderEvent>