패키지 | org.osmf.traits |
클래스 | public class MediaTraitBase |
상속 | MediaTraitBase EventDispatcher Object |
하위 클래스 | AlternativeAudioTrait, AudioTrait, BufferTrait, DisplayObjectTrait, DRMTrait, DVRTrait, DynamicStreamTrait, LoadTrait, PlayTrait, SeekTrait, TimeTrait |
언어 버전: | ActionScript 3.0 |
제품 버전: | OSMF 1.0 |
런타임 버전: | Flash Player 10, AIR 1.5 |
Media traits are first-class members of the object model for a number of reasons:
- Traits allow us to isolate common aspects of different media types into reusable building blocks. For example, music and video may share a common implementation for audio. An "audio" trait can encapsulate that common implementation in such a way that it can be used for both media types, while still providing a uniform interface to these different media types.
- Different media elements may have their capabilities change dynamically over time, and traits allow us to isolate these capabilities in such a way that we can clearly express that dynamism. For example, a video player might not initially be "viewable", due to its need to be loaded before playback can begin. Rather than express this dynamism through changes to a set of methods on a monolithic media class, we can express it through the presence or absence of a trait instance on a lighter weight media class.
- Traits make compositioning scalable. (Compositioning is the ability to temporally and spatially composite collections of media.) If traits represent the overall vocabulary of the media framework, then we can implement compositioning primarily in terms of the traits, rather than in terms of the media that aggregate those traits. This approach allows developers to create new media implementations that can easily integrate with the compositioning parts of the framework without requiring changes to that framework. Our working assumption, of course, is that most (if not all) media will generally share the same vocabulary, which can be expressed through a core set of media traits.
- Traits allow for uniform, media-agnostic client classes. For example, if a client class is capable of rendering the "display object" trait, then it's capable of rendering any and all media that host that trait.
It's important to be aware of the relationship between a media trait and a media element. Some media trait implementations will be tightly coupled to a specific type of media element, while others will be generic enough to work with any media element. For example, an implementation of a "play" trait that works with video is typically going to be specific to one class of media elements, namely the class that plays video, since the playback operations will be specific to the underlying implementation of video (i.e. NetStream). On the other hand, an implementation of a "display object" trait might be able to work with any media element, since DisplayObjectTrait will use the same underlying media implementation (DisplayObject) for any media element.
속성 | 정의 주체 | ||
---|---|---|---|
constructor : Object
지정된 객체 인스턴스의 클래스 객체 또는 생성자 함수에 대한 참조입니다. | Object | ||
traitType : String [읽기 전용]
The MediaTraitType for this trait. | MediaTraitBase |
메서드 | 정의 주체 | ||
---|---|---|---|
MediaTraitBase(traitType:String)
Constructor. | MediaTraitBase | ||
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 |
traitType | 속성 |
MediaTraitBase | () | 생성자 |
dispose | () | 메서드 |
public function dispose():void
언어 버전: | ActionScript 3.0 |
제품 버전: | OSMF 1.0 |
런타임 버전: | Flash Player 10, AIR 1.5 |
Disposes of any resources used by this trait. Called by the framework whenever a trait is removed from a MediaElement.
Subclasses should override to do any disposal logic specific to their implementation.
Tue Jun 12 2018, 03:17 PM Z