Pakiet | org.osmf.media |
Klasa | public class MediaFactory |
Dziedziczenie | MediaFactory ![]() ![]() |
Podklasy | DefaultMediaFactory |
Wersja języka: | ActionScript 3.0 |
Wersja produktu: | OSMF 1.0 |
Wersje środowiska wykonawczego: | Flash Player 10, AIR 1.5 |
The factory operation takes a MediaResourceBase as input and produces a MediaElement as output.
The MediaFactory maintains a list of MediaFactoryItem objects, each of which encapsulates all the information necessary to create a specific MediaElement. The MediaFactory relies on the canHandleResourceFunction method of each MediaFactoryItem to find a MediaFactoryItem object that can handle the specified MediaResourceBase.
The factory interface also exposes methods for querying for specific MediaFactoryItem objects, and for loading plugins (which hold MediaFactoryItem objects).
Powiązane elementy interfejsu API
Właściwość | Zdefiniowane przez | ||
---|---|---|---|
![]() | constructor : Object
Odwołanie do obiektu klasy lub funkcji konstruktora, dotyczące danej instancji obiektu. | Object |
Metoda | Zdefiniowane przez | ||
---|---|---|---|
![]() | addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
Rejestruje obiekt detektora zdarzeń w obiekcie EventDispatcher, dzięki czemu detektor będzie otrzymywał powiadomienia o zdarzeniu. | EventDispatcher | |
![]() |
Wywołuje zdarzenie, tj. kieruje je do przepływu zdarzeń. | EventDispatcher | |
![]() |
Sprawdza, czy obiekt EventDispatcher zawiera jakiekolwiek detektory zarejestrowane dla konkretnego typu zdarzeń. | EventDispatcher | |
![]() |
Wskazuje, czy dla obiektu zdefiniowano określoną właściwość. | Object | |
![]() |
Wskazuje, czy instancja klasy Object należy do łańcucha prototypów obiektu określonego jako parametr. | Object | |
![]() |
Wskazuje, czy określona właściwość istnieje i jest przeliczalna. | Object | |
![]() |
Usuwa detektor z obiektu EventDispatcher. | EventDispatcher | |
![]() |
Ustawia dostępność właściwości dynamicznej używanej w pętlach. | Object | |
![]() |
Zwraca ciąg reprezentujący obiekt — sformatowany zgodnie z konwencjami właściwymi dla ustawień regionalnych. | Object | |
![]() |
Zwraca ciąg reprezentujący określony obiekt. | Object | |
![]() |
Zwraca pierwotną wartość dla określonego obiektu. | Object | |
![]() |
Sprawdza, czy detektor zdarzeń określonego typu jest zarejestrowany w tym obiekcie EventDispatcher lub jego elementach macierzystych. | EventDispatcher |
Metoda | Zdefiniowane przez | ||
---|---|---|---|
Returns the most appropriate MediaFactoryItem for the specified resource
out of the MediaFactoryItems in the specified list. | MediaFactory |
Zdarzenie | Podsumowanie | Zdefiniowane przez | ||
---|---|---|---|---|
![]() | [zdarzenie broadcast] Wywoływane, gdy program Flash Player lub aplikacja środowiska wykonawczego AIR uzyskuje fokus w systemie operacyjnym i przechodzi w stan aktywny. | EventDispatcher | ||
![]() | [zdarzenie broadcast] Wywoływane, gdy program Flash Player lub aplikacja AIR traci fokus w systemie operacyjnym i przechodzi w stan nieaktywny. | EventDispatcher |
resolveItems | () | metoda |
protected function resolveItems(resource:MediaResourceBase, items:Vector.<MediaFactoryItem>):MediaFactoryItem
Returns the most appropriate MediaFactoryItem for the specified resource
out of the MediaFactoryItems in the specified list.
This method is invoked when createMediaElement
is invoked
with a resource that more than one MediaFactoryItem can handle. Subclasses
can override to select the most appropriate one.
The default behavior is to select the first item which is not "native" to
the framework, under the theory that plugins ought to take precedence over
core media types. It makes this decision based on the presence or absence
of an id value which starts with "org.osmf".
Parametry
resource:MediaResourceBase | |
items:Vector.<MediaFactoryItem> |
MediaFactoryItem |
package org.osmf.media { import flash.display.Sprite; import org.osmf.events.MediaFactoryEvent; public class MediaFactoryExample extends Sprite { public function MediaFactoryExample() { // Construct a media factory, and listen to its plug-in related events: var factory:MediaFactory = new MediaFactory(); factory.addEventListener(MediaFactoryEvent.PLUGIN_LOAD, onPluginLoaded); factory.addEventListener(MediaFactoryEvent.PLUGIN_LOAD_ERROR, onPluginLoadError); // Instruct the factory to load the plug-in at the given url: factory.loadPlugin(new URLResource("http://myinvalidurl.com/foo.swf")); } private function onPluginLoaded(event:MediaFactoryEvent):void { // Use the factory to create a media-element related to the plugin: var factory:MediaFactory = event.target as MediaFactory; factory.createMediaElement(new URLResource("http://myinvalidurl.com/content")); } private function onPluginLoadError(event:MediaFactoryEvent):void { // Handle plug-in loading failure: trace("Plugin failed to load."); } } }
Tue Jun 12 2018, 12:06 PM Z