Pacchetto | org.osmf.media |
Classe | public class MediaFactory |
Ereditarietà | MediaFactory EventDispatcher Object |
Sottoclassi | DefaultMediaFactory |
Versione linguaggio: | ActionScript 3.0 |
Versione prodotto: | OSMF 1.0 |
Versioni runtime: | 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).
Elementi API correlati
Proprietà | Definito da | ||
---|---|---|---|
constructor : Object
Un riferimento all'oggetto classe o alla funzione di costruzione per una determinata istanza di oggetto. | Object | ||
numItems : int [sola lettura]
The number of MediaFactoryItems managed by the factory. | MediaFactory |
Metodo | Definito da | ||
---|---|---|---|
Constructor. | MediaFactory | ||
addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
Registra un oggetto listener di eventi con un oggetto EventDispatcher, in modo che il listener riceva la notifica di un evento. | EventDispatcher | ||
Adds the specified MediaFactoryItem to the factory. | MediaFactory | ||
Returns a MediaElement that can be created based on the specified
MediaResourceBase. | MediaFactory | ||
Invia un evento nel flusso di eventi. | 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 | ||
Verifica se per l'oggetto EventDispatcher sono presenti listener registrati per un tipo specifico di evento. | EventDispatcher | ||
Indica se per un oggetto è definita una proprietà specifica. | Object | ||
Indica se un'istanza della classe Object si trova nella catena di prototipi dell'oggetto specificato come parametro. | Object | ||
Load a plugin identified by the specified resource. | MediaFactory | ||
Indica se la proprietà specificata esiste ed è enumerabile. | Object | ||
Rimuove un listener dall'oggetto EventDispatcher. | EventDispatcher | ||
Removes the specified MediaFactoryItem from the factory. | MediaFactory | ||
Imposta la disponibilità di una proprietà dinamica per le operazioni cicliche. | Object | ||
Restituisce la rappresentazione in formato stringa di questo oggetto, formattato in base alle convenzioni specifiche per le versioni localizzate. | Object | ||
Restituisce la rappresentazione in formato stringa dell'oggetto specificato. | Object | ||
Restituisce il valore di base dell'oggetto specificato. | Object | ||
Verifica se un listener di eventi è registrato con questo oggetto EventDispatcher o qualsiasi suo antenato per il tipo di evento specificato. | EventDispatcher |
Metodo | Definito da | ||
---|---|---|---|
Returns the most appropriate MediaFactoryItem for the specified resource
out of the MediaFactoryItems in the specified list. | MediaFactory |
Evento | Riepilogo | Definito da | ||
---|---|---|---|---|
[evento di trasmissione] Inviato quando Flash Player o l'applicazione AIR ottiene lo stato di attivazione del sistema operativo ed entra nello stato attivo. | EventDispatcher | |||
[evento di trasmissione] Inviato quando Flash Player o l'applicazione AIR perde l'attivazione del sistema operativo e sta entrando nello stato inattivo. | 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 | proprietà |
MediaFactory | () | Funzione di costruzione |
public function MediaFactory()
Versione linguaggio: | ActionScript 3.0 |
Versione prodotto: | OSMF 1.0 |
Versioni runtime: | Flash Player 10, AIR 1.5 |
Constructor.
addItem | () | metodo |
public function addItem(item:MediaFactoryItem):void
Versione linguaggio: | ActionScript 3.0 |
Versione prodotto: | OSMF 1.0 |
Versioni runtime: | 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.
Parametri
item:MediaFactoryItem — The MediaFactoryItem to add.
|
Genera
ArgumentError — If the argument is null or if the argument
has a null ID field.
|
createMediaElement | () | metodo |
public function createMediaElement(resource:MediaResourceBase):MediaElement
Versione linguaggio: | ActionScript 3.0 |
Versione prodotto: | OSMF 1.0 |
Versioni runtime: | 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.
Parametri
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 | () | metodo |
public function getItemAt(index:int):MediaFactoryItem
Versione linguaggio: | ActionScript 3.0 |
Versione prodotto: | OSMF 1.0 |
Versioni runtime: | Flash Player 10, AIR 1.5 |
Gets the MediaFactoryItem at the specified index.
Parametri
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 | () | metodo |
public function getItemById(id:String):MediaFactoryItem
Versione linguaggio: | ActionScript 3.0 |
Versione prodotto: | OSMF 1.0 |
Versioni runtime: | 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.
Parametri
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 | () | metodo |
public function loadPlugin(resource:MediaResourceBase):void
Versione linguaggio: | ActionScript 3.0 |
Versione prodotto: | OSMF 1.0 |
Versioni runtime: | 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.
Parametri
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.
|
Genera
ArgumentError — If resource is null or resource is neither an URLResource
nor a PluginInfoResource.
|
removeItem | () | metodo |
public function removeItem(item:MediaFactoryItem):void
Versione linguaggio: | ActionScript 3.0 |
Versione prodotto: | OSMF 1.0 |
Versioni runtime: | Flash Player 10, AIR 1.5 |
Removes the specified MediaFactoryItem from the factory. If no such MediaFactoryItem exists in this factory, does nothing.
Parametri
item:MediaFactoryItem — The MediaFactoryItem to remove.
|
Genera
ArgumentError — If the argument is null or if the argument
has a null ID field.
|
resolveItems | () | metodo |
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".
Parametri
resource:MediaResourceBase | |
items:Vector.<MediaFactoryItem> |
MediaFactoryItem |
mediaElementCreate | Evento |
org.osmf.events.MediaFactoryEvent
proprietà MediaFactoryEvent.type =
org.osmf.events.MediaFactoryEvent.MEDIA_ELEMENT_CREATE
Versione linguaggio: | ActionScript 3.0 |
Versione prodotto: | OSMF 1.0 |
Versioni runtime: | 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 | Evento |
org.osmf.events.MediaFactoryEvent
proprietà MediaFactoryEvent.type =
org.osmf.events.MediaFactoryEvent.PLUGIN_LOAD
Versione linguaggio: | ActionScript 3.0 |
Versione prodotto: | OSMF 1.0 |
Versioni runtime: | 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 | Evento |
org.osmf.events.MediaFactoryEvent
proprietà MediaFactoryEvent.type =
org.osmf.events.MediaFactoryEvent.PLUGIN_LOAD_ERROR
Versione linguaggio: | ActionScript 3.0 |
Versione prodotto: | OSMF 1.0 |
Versioni runtime: | 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, 02:44 PM Z