套件 | org.osmf.traits |
類別 | public class DisplayObjectTrait |
繼承 | DisplayObjectTrait MediaTraitBase EventDispatcher Object |
語言版本: | ActionScript 3.0 |
產品版本: | OSMF 1.0 |
執行階段版本: | 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.
相關 API 元素
屬性 | 定義自 | ||
---|---|---|---|
constructor : Object
類別物件的參照或是特定物件實體的建構函數。 | Object | ||
displayObject : DisplayObject [唯讀]
The media's display object. | DisplayObjectTrait | ||
mediaHeight : Number [唯讀]
The intrinsic height of the media. | DisplayObjectTrait | ||
mediaWidth : Number [唯讀]
The intrinsic width of the media. | DisplayObjectTrait | ||
traitType : String [唯讀]
The MediaTraitType for this trait. | MediaTraitBase |
方法 | 定義自 | ||
---|---|---|---|
Constructor. | DisplayObjectTrait | ||
addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
會在 EventDispatcher 物件註冊事件偵聽程式,以便讓偵聽程式收到事件的通知。 | EventDispatcher | ||
會將事件傳送到事件流程。 | EventDispatcher | ||
Disposes of any resources used by this trait. | MediaTraitBase | ||
會檢查 EventDispatcher 物件是否有對特定的事件類型註冊偵聽程式。 | EventDispatcher | ||
指出物件是否有已定義的指定屬性。 | Object | ||
指出 Object 類別的實體是否位於指定為參數的物件原型鏈中。 | Object | ||
指出指定的屬性是否存在,以及是否可列舉。 | Object | ||
會從 EventDispatcher 物件移除偵聽程式。 | EventDispatcher | ||
為迴圈作業設定動態屬性的可用性。 | Object | ||
傳回代表此物件的字串,根據地區特定慣例進行格式化。 | Object | ||
會傳回指定之物件的字串形式。 | Object | ||
會傳回指定之物件的基本值。 | Object | ||
檢查此 EventDispatcher 物件是否已註冊事件偵聽程式,或者此物件的任何祖系已為特定事件類型註冊事件偵聽程式。 | EventDispatcher |
方法 | 定義自 | ||
---|---|---|---|
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 |
事件 | 摘要 | 定義自 | ||
---|---|---|---|---|
[廣播事件] 當 Flash Player 或 AIR 應用程式取得作業系統焦點並成為作用中時傳送。 | EventDispatcher | |||
[廣播事件] 當 Flash Player 或 AIR 應用程式失去作業系統焦點並成為非作用中時傳送。 | 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 | 屬性 |
displayObject:DisplayObject
[唯讀] 語言版本: | ActionScript 3.0 |
產品版本: | OSMF 1.0 |
執行階段版本: | Flash Player 10, AIR 1.5 |
The media's display object.
實作
public function get displayObject():DisplayObject
mediaHeight | 屬性 |
mediaWidth | 屬性 |
DisplayObjectTrait | () | 建構函式 |
public function DisplayObjectTrait(displayObject:DisplayObject, mediaWidth:Number = 0, mediaHeight:Number = 0)
語言版本: | ActionScript 3.0 |
產品版本: | OSMF 1.0 |
執行階段版本: | Flash Player 10, AIR 1.5 |
Constructor.
參數displayObject:DisplayObject | |
mediaWidth:Number (default = 0 )
| |
mediaHeight:Number (default = 0 )
|
displayObjectChangeEnd | () | 方法 |
protected function displayObjectChangeEnd(oldDisplayObject:DisplayObject):void
語言版本: | ActionScript 3.0 |
產品版本: | OSMF 1.0 |
執行階段版本: | 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.
參數
oldDisplayObject:DisplayObject — Previous displayObject value.
|
displayObjectChangeStart | () | 方法 |
protected function displayObjectChangeStart(newView:DisplayObject):void
語言版本: | ActionScript 3.0 |
產品版本: | OSMF 1.0 |
執行階段版本: | 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.
參數
newView:DisplayObject — New displayObject value.
|
mediaSizeChangeEnd | () | 方法 |
protected function mediaSizeChangeEnd(oldMediaWidth:Number, oldMediaHeight:Number):void
語言版本: | ActionScript 3.0 |
產品版本: | OSMF 1.0 |
執行階段版本: | 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.
參數
oldMediaWidth:Number — Previous mediaWidth value.
| |
oldMediaHeight:Number — Previous mediaHeight value.
|
mediaSizeChangeStart | () | 方法 |
protected function mediaSizeChangeStart(newMediaWidth:Number, newMediaHeight:Number):void
語言版本: | ActionScript 3.0 |
產品版本: | OSMF 1.0 |
執行階段版本: | 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.
參數
newMediaWidth:Number — New mediaWidth value.
| |
newMediaHeight:Number — New mediaHeight value.
|
setDisplayObject | () | 方法 |
protected final function setDisplayObject(value:DisplayObject):void
語言版本: | ActionScript 3.0 |
產品版本: | OSMF 1.0 |
執行階段版本: | 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.
參數
value:DisplayObject |
setMediaSize | () | 方法 |
protected final function setMediaSize(mediaWidth:Number, mediaHeight:Number):void
語言版本: | ActionScript 3.0 |
產品版本: | OSMF 1.0 |
執行階段版本: | 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.
參數
mediaWidth:Number — The new width.
| |
mediaHeight:Number — The new height.
|
displayObjectChange | 事件 |
org.osmf.events.DisplayObjectEvent
屬性 DisplayObjectEvent.type =
org.osmf.events.DisplayObjectEvent.DISPLAY_OBJECT_CHANGE
語言版本: | ActionScript 3.0 |
產品版本: | OSMF 1.0 |
執行階段版本: | 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 | 事件 |
org.osmf.events.DisplayObjectEvent
屬性 DisplayObjectEvent.type =
org.osmf.events.DisplayObjectEvent.MEDIA_SIZE_CHANGE
語言版本: | ActionScript 3.0 |
產品版本: | OSMF 1.0 |
執行階段版本: | 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.Tue Jun 12 2018, 03:47 PM Z