Paket | org.osmf.media |
Klass | public class MediaFactory |
Arv | MediaFactory EventDispatcher Object |
Underklasser | DefaultMediaFactory |
Språkversion: | ActionScript 3.0 |
Produktversion: | OSMF 1.0 |
Körningsmiljöversioner: | 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).
Relaterade API-element
Egenskap | Definieras med | ||
---|---|---|---|
constructor : Object
En referens till klassobjektet eller konstruktorfunktionen för en given objektinstans. | Object | ||
numItems : int [skrivskyddad]
The number of MediaFactoryItems managed by the factory. | MediaFactory |
Metod | Definieras med | ||
---|---|---|---|
Constructor. | MediaFactory | ||
addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
Registrerar ett händelseavlyssnarobjekt för ett EventDispatcher-objekt så att avlyssnaren får meddelanden om händelser. | EventDispatcher | ||
Adds the specified MediaFactoryItem to the factory. | MediaFactory | ||
Returns a MediaElement that can be created based on the specified
MediaResourceBase. | MediaFactory | ||
Skickar en händelse till händelseflödet. | EventDispatcher | ||
Gets the MediaFactoryItem at the specified index. | MediaFactory | ||
Returns the MediaFactoryItem with the specified ID or null if the
specified MediaFactoryItem does not exist in this factory. | MediaFactory | ||
Kontrollerar om EventDispatcher-objektet har några avlyssnare registrerade för en viss typ av händelse. | EventDispatcher | ||
Anger om det finns en egenskap angiven för ett objekt. | Object | ||
Anger om en instans av klassen Object finns i prototypkedjan för objektet som anges som parameter. | Object | ||
Load a plugin identified by the specified resource. | MediaFactory | ||
Anger om den angivna egenskapen finns och är uppräkningsbar. | Object | ||
Tar bort en avlyssnare från EventDispatcher-objektet. | EventDispatcher | ||
Removes the specified MediaFactoryItem from the factory. | MediaFactory | ||
Anger tillgänglighet för en dynamisk egenskap för slingåtgärder. | Object | ||
Returnerar det här objektets strängrepresentation, formaterad i enlighet med språkspecifika konventioner. | Object | ||
Returnerar det angivna objektets strängbeteckning. | Object | ||
Returnerar det angivna objektets primitiva värde. | Object | ||
Kontrollerar om en händelseavlyssnare är registrerad för det här EventDispatcher-objektet eller något av dess överordnade objekt för den angivna händelsetypen. | EventDispatcher |
Metod | Definieras med | ||
---|---|---|---|
Returns the most appropriate MediaFactoryItem for the specified resource
out of the MediaFactoryItems in the specified list. | MediaFactory |
Händelse | Sammanfattning | Definieras med | ||
---|---|---|---|---|
[utsändningshändelse] Skickas när Flash Player eller AIR får operativsystemfokus och blir aktivt. | EventDispatcher | |||
[utsändningshändelse] Skickas när Flash Player eller AIR förlorar operativsystemfokus och blir inaktivt. | EventDispatcher | |||
Dispatched when the MediaFactory has created a MediaElement. | MediaFactory | |||
Dispatched when the MediaFactory has successfully loaded a plugin. | MediaFactory | |||
Dispatched when the MediaFactory has failed to load a plugin due to an error. | MediaFactory |
numItems | egenskap |
MediaFactory | () | Konstruktor |
public function MediaFactory()
Språkversion: | ActionScript 3.0 |
Produktversion: | OSMF 1.0 |
Körningsmiljöversioner: | Flash Player 10, AIR 1.5 |
Constructor.
addItem | () | metod |
public function addItem(item:MediaFactoryItem):void
Språkversion: | ActionScript 3.0 |
Produktversion: | OSMF 1.0 |
Körningsmiljöversioner: | Flash Player 10, AIR 1.5 |
Adds the specified MediaFactoryItem to the factory. After the MediaFactoryItem has been added, for any MediaResourceBase that this MediaFactoryItem can handle, the factory will be able to create the corresponding media element. If a MediaFactoryItem with the same ID already exists in this factory, the new MediaFactoryItem object replaces it.
Parametrar
item:MediaFactoryItem — The MediaFactoryItem to add.
|
Utlöser
ArgumentError — If the argument is null or if the argument
has a null ID field.
|
createMediaElement | () | metod |
public function createMediaElement(resource:MediaResourceBase):MediaElement
Språkversion: | ActionScript 3.0 |
Produktversion: | OSMF 1.0 |
Körningsmiljöversioner: | Flash Player 10, AIR 1.5 |
Returns a MediaElement that can be created based on the specified MediaResourceBase.
Returns null
if the factory cannot
find a MediaFactoryItem object
capable of creating such a MediaElement in this factory.
Parametrar
resource:MediaResourceBase — The MediaResourceBase for which a corresponding
MediaElement should be created.
|
MediaElement — The MediaElement that was created or null if no such
MediaElement could be created from the resource.
|
getItemAt | () | metod |
public function getItemAt(index:int):MediaFactoryItem
Språkversion: | ActionScript 3.0 |
Produktversion: | OSMF 1.0 |
Körningsmiljöversioner: | Flash Player 10, AIR 1.5 |
Gets the MediaFactoryItem at the specified index.
Parametrar
index:int — The index in the list from which to retrieve the MediaFactoryItem.
|
MediaFactoryItem — The MediaFactoryItem at that index or null if there is none.
|
getItemById | () | metod |
public function getItemById(id:String):MediaFactoryItem
Språkversion: | ActionScript 3.0 |
Produktversion: | OSMF 1.0 |
Körningsmiljöversioner: | Flash Player 10, AIR 1.5 |
Returns the MediaFactoryItem with the specified ID or null
if the
specified MediaFactoryItem does not exist in this factory.
Parametrar
id:String — ID of the MediaFactoryItem to retrieve.
|
MediaFactoryItem — The MediaFactoryItem with the specified ID or null if the specified
MediaFactoryItem does not exist in this factory.
|
loadPlugin | () | metod |
public function loadPlugin(resource:MediaResourceBase):void
Språkversion: | ActionScript 3.0 |
Produktversion: | OSMF 1.0 |
Körningsmiljöversioner: | Flash Player 10, AIR 1.5 |
Load a plugin identified by the specified resource. The MediaFactory will not reload the plugin if it has already been loaded. Upon successful loading, the MediaFactoryItems within the plugin's PluginInfo property will be added to this MediaFactory, and a MediaFactoryEvent.PLUGIN_LOAD event will be dispatched. OtherwiseIf the load fails, a MediaFactoryEvent.PLUGIN_LOAD_ERROR event will be dispatched.
Parametrar
resource:MediaResourceBase — MediaResourceBase representing the plugin. For remote (dynamic)
plugins, use an URLResource pointing to the remote SWF to load. For local
(static) plugins, use a PluginInfoResource.
|
Utlöser
ArgumentError — If resource is null or resource is neither an URLResource
nor a PluginInfoResource.
|
removeItem | () | metod |
public function removeItem(item:MediaFactoryItem):void
Språkversion: | ActionScript 3.0 |
Produktversion: | OSMF 1.0 |
Körningsmiljöversioner: | Flash Player 10, AIR 1.5 |
Removes the specified MediaFactoryItem from the factory. If no such MediaFactoryItem exists in this factory, does nothing.
Parametrar
item:MediaFactoryItem — The MediaFactoryItem to remove.
|
Utlöser
ArgumentError — If the argument is null or if the argument
has a null ID field.
|
resolveItems | () | metod |
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".
Parametrar
resource:MediaResourceBase | |
items:Vector.<MediaFactoryItem> |
MediaFactoryItem |
mediaElementCreate | Händelse |
org.osmf.events.MediaFactoryEvent
egenskap MediaFactoryEvent.type =
org.osmf.events.MediaFactoryEvent.MEDIA_ELEMENT_CREATE
Språkversion: | ActionScript 3.0 |
Produktversion: | OSMF 1.0 |
Körningsmiljöversioner: | Flash Player 10, AIR 1.5 |
Dispatched when the MediaFactory has created a MediaElement.
The MediaFactoryEvent.MEDIA_ELEMENT_CREATE constant defines the value of the type property of the event object for a mediaElementCreate event.pluginLoad | Händelse |
org.osmf.events.MediaFactoryEvent
egenskap MediaFactoryEvent.type =
org.osmf.events.MediaFactoryEvent.PLUGIN_LOAD
Språkversion: | ActionScript 3.0 |
Produktversion: | OSMF 1.0 |
Körningsmiljöversioner: | Flash Player 10, AIR 1.5 |
Dispatched when the MediaFactory has successfully loaded a plugin.
The MediaFactoryEvent.PLUGIN_LOAD constant defines the value of the type property of the event object for a pluginLoad event.pluginLoadError | Händelse |
org.osmf.events.MediaFactoryEvent
egenskap MediaFactoryEvent.type =
org.osmf.events.MediaFactoryEvent.PLUGIN_LOAD_ERROR
Språkversion: | ActionScript 3.0 |
Produktversion: | OSMF 1.0 |
Körningsmiljöversioner: | Flash Player 10, AIR 1.5 |
Dispatched when the MediaFactory has failed to load a plugin due to an error.
The MediaFactoryEvent.PLUGIN_LOAD_ERROR constant defines the value of the type property of the event object for a pluginLoadError event.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, 01:40 PM Z