Package | org.osmf.traits |
Class | public class DisplayObjectTrait |
Inheritance | DisplayObjectTrait MediaTraitBase EventDispatcher Object |
Language Version: | ActionScript 3.0 |
Product Version: | OSMF 1.0 |
Runtime Versions: | Flash Player 10, AIR 1.5 |
For an image, for example, the intrinsic dimensions are the height and width of the image as it is stored.
Use the MediaElement.hasTrait(MediaTraitType.DISPLAY_OBJECT)
method to query
whether a media element has a trait of this type.
If hasTrait(MediaTraitType.DISPLAY_OBJECT)
returns true
,
use the MediaElement.getTrait(MediaTraitType.DISPLAY_OBJECT)
method
to get an object that is of this type.
Related API Elements
Property | Defined By | ||
---|---|---|---|
constructor : Object
A reference to the class object or constructor function for a given object instance. | Object | ||
displayObject : DisplayObject [read-only]
The media's display object. | DisplayObjectTrait | ||
mediaHeight : Number [read-only]
The intrinsic height of the media. | DisplayObjectTrait | ||
mediaWidth : Number [read-only]
The intrinsic width of the media. | DisplayObjectTrait | ||
traitType : String [read-only]
The MediaTraitType for this trait. | MediaTraitBase |
Method | Defined By | ||
---|---|---|---|
Constructor. | DisplayObjectTrait | ||
addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
Registers an event listener object with an EventDispatcher object so that the listener
receives notification of an event. | EventDispatcher | ||
Dispatches an event into the event flow. | EventDispatcher | ||
Disposes of any resources used by this trait. | MediaTraitBase | ||
Checks whether the EventDispatcher object has any listeners registered for a specific type
of event. | EventDispatcher | ||
Indicates whether an object has a specified property defined. | Object | ||
Indicates whether an instance of the Object class is in the prototype chain of the object specified
as the parameter. | Object | ||
Indicates whether the specified property exists and is enumerable. | Object | ||
Removes a listener from the EventDispatcher object. | EventDispatcher | ||
Sets the availability of a dynamic property for loop operations. | Object | ||
Returns the string representation of this object, formatted according to locale-specific conventions. | Object | ||
Returns the string representation of the specified object. | Object | ||
Returns the primitive value of the specified object. | Object | ||
Checks whether an event listener is registered with this EventDispatcher object or any of
its ancestors for the specified event type. | EventDispatcher |
Method | Defined By | ||
---|---|---|---|
Called just after the displayObject property has changed. | DisplayObjectTrait | ||
Called immediately before the displayObject property is changed. | DisplayObjectTrait | ||
Called just after setMediaSize() has applied new mediaWidth
and/or mediaHeight values. | DisplayObjectTrait | ||
Called just before a call to setMediaSize(). | DisplayObjectTrait | ||
Defines the trait's displayObject. | DisplayObjectTrait | ||
Sets the trait's width and height. | DisplayObjectTrait |
Event | Summary | Defined By | ||
---|---|---|---|---|
[broadcast event] Dispatched when the Flash Player or AIR application gains operating system focus and becomes active. | EventDispatcher | |||
[broadcast event] Dispatched when the Flash Player or AIR application operating loses system focus and is becoming inactive. | EventDispatcher | |||
Dispatched when the trait's displayObject property has changed. | DisplayObjectTrait | |||
Dispatched when the trait's mediaWidth and/or mediaHeight property has changed. | DisplayObjectTrait |
displayObject | property |
displayObject:DisplayObject
[read-only] Language Version: | ActionScript 3.0 |
Product Version: | OSMF 1.0 |
Runtime Versions: | Flash Player 10, AIR 1.5 |
The media's display object.
Implementation
public function get displayObject():DisplayObject
mediaHeight | property |
mediaWidth | property |
DisplayObjectTrait | () | Constructor |
public function DisplayObjectTrait(displayObject:DisplayObject, mediaWidth:Number = 0, mediaHeight:Number = 0)
Language Version: | ActionScript 3.0 |
Product Version: | OSMF 1.0 |
Runtime Versions: | Flash Player 10, AIR 1.5 |
Constructor.
ParametersdisplayObject:DisplayObject | |
mediaWidth:Number (default = 0 )
| |
mediaHeight:Number (default = 0 )
|
displayObjectChangeEnd | () | method |
protected function displayObjectChangeEnd(oldDisplayObject:DisplayObject):void
Language Version: | ActionScript 3.0 |
Product Version: | OSMF 1.0 |
Runtime Versions: | Flash Player 10, AIR 1.5 |
Called just after the displayObject
property has changed.
Dispatches the change event.
Subclasses that override should call this method to dispatch the displayObjectChange event.
Parameters
oldDisplayObject:DisplayObject — Previous displayObject value.
|
displayObjectChangeStart | () | method |
protected function displayObjectChangeStart(newView:DisplayObject):void
Language Version: | ActionScript 3.0 |
Product Version: | OSMF 1.0 |
Runtime Versions: | Flash Player 10, AIR 1.5 |
Called immediately before the displayObject
property is changed.
Subclasses can override this method to communicate the change to the media.
Parameters
newView:DisplayObject — New displayObject value.
|
mediaSizeChangeEnd | () | method |
protected function mediaSizeChangeEnd(oldMediaWidth:Number, oldMediaHeight:Number):void
Language Version: | ActionScript 3.0 |
Product Version: | OSMF 1.0 |
Runtime Versions: | Flash Player 10, AIR 1.5 |
Called just after setMediaSize()
has applied new mediaWidth
and/or mediaHeight values. Dispatches the change event.
Subclasses that override should call this method to dispatch the mediaSizeChange event.
Parameters
oldMediaWidth:Number — Previous mediaWidth value.
| |
oldMediaHeight:Number — Previous mediaHeight value.
|
mediaSizeChangeStart | () | method |
protected function mediaSizeChangeStart(newMediaWidth:Number, newMediaHeight:Number):void
Language Version: | ActionScript 3.0 |
Product Version: | OSMF 1.0 |
Runtime Versions: | Flash Player 10, AIR 1.5 |
Called just before a call to setMediaSize()
.
Subclasses can override this method to communicate the change to the media.
Parameters
newMediaWidth:Number — New mediaWidth value.
| |
newMediaHeight:Number — New mediaHeight value.
|
setDisplayObject | () | method |
protected final function setDisplayObject(value:DisplayObject):void
Language Version: | ActionScript 3.0 |
Product Version: | OSMF 1.0 |
Runtime Versions: | Flash Player 10, AIR 1.5 |
Defines the trait's displayObject. If the displayObject is different from the one that is currently set, a displayObjectChange event will be dispatched.
Parameters
value:DisplayObject |
setMediaSize | () | method |
protected final function setMediaSize(mediaWidth:Number, mediaHeight:Number):void
Language Version: | ActionScript 3.0 |
Product Version: | OSMF 1.0 |
Runtime Versions: | Flash Player 10, AIR 1.5 |
Sets the trait's width and height.
Forces non numerical and negative values to zero.
If the either the width or the height differs from the previous width or height, dispatches a mediaSizeChange event.
Parameters
mediaWidth:Number — The new width.
| |
mediaHeight:Number — The new height.
|
displayObjectChange | Event |
org.osmf.events.DisplayObjectEvent
property DisplayObjectEvent.type =
org.osmf.events.DisplayObjectEvent.DISPLAY_OBJECT_CHANGE
Language Version: | ActionScript 3.0 |
Product Version: | OSMF 1.0 |
Runtime Versions: | Flash Player 10, AIR 1.5 |
Dispatched when the trait's displayObject
property has changed.
This occurs when a different DisplayObject is assigned to represent the media.
mediaSizeChange | Event |
org.osmf.events.DisplayObjectEvent
property DisplayObjectEvent.type =
org.osmf.events.DisplayObjectEvent.MEDIA_SIZE_CHANGE
Language Version: | ActionScript 3.0 |
Product Version: | OSMF 1.0 |
Runtime Versions: | Flash Player 10, AIR 1.5 |
Dispatched when the trait's mediaWidth and/or mediaHeight property has changed.
The DisplayObjectEvent.MEDIA_SIZE_CHANGE constant defines the value of the type property of the event object for a mediaSizeChange event.Wed Nov 21 2018, 06:34 AM -08:00