Pakket | org.osmf.media |
Klasse | public class MediaFactory |
Overerving | MediaFactory EventDispatcher Object |
Subklassen | DefaultMediaFactory |
Taalversie: | ActionScript 3.0 |
Productversie: | OSMF 1.0 |
Runtimeversies: | 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).
Verwante API-elementen
Eigenschap | Gedefinieerd door | ||
---|---|---|---|
constructor : Object
Verwijzing naar het klasseobject of de constructorfunctie van een bepaalde objectinstantie. | Object | ||
numItems : int [alleen-lezen]
The number of MediaFactoryItems managed by the factory. | MediaFactory |
Methode | Gedefinieerd door | ||
---|---|---|---|
Constructor. | MediaFactory | ||
addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
Registreert een gebeurtenislistenerobject bij een object EventDispatcher, zodat de listener een melding van een gebeurtenis ontvangt. | EventDispatcher | ||
Adds the specified MediaFactoryItem to the factory. | MediaFactory | ||
Returns a MediaElement that can be created based on the specified
MediaResourceBase. | MediaFactory | ||
Verzendt een gebeurtenis naar de gebeurtenisstroom. | 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 | ||
Controleert of het object EventDispatcher listeners heeft geregistreerd voor een specifiek type gebeurtenis. | EventDispatcher | ||
Geeft aan of voor een object een opgegeven eigenschap is gedefinieerd. | Object | ||
Geeft aan of een instantie van de klasse Object zich in de prototypeketen van het object bevindt dat als parameter is opgegeven. | Object | ||
Load a plugin identified by the specified resource. | MediaFactory | ||
Geeft aan of de opgegeven eigenschap bestaat en kan worden opgesomd. | Object | ||
Verwijdert een listener uit het object EventDispatcher. | EventDispatcher | ||
Removes the specified MediaFactoryItem from the factory. | MediaFactory | ||
Stelt de beschikbaarheid van een dynamische eigenschap voor lusbewerkingen in. | Object | ||
Geeft de tekenreeksweergave van dit object weer, geformatteerd volgens de locatiespecifieke conventies. | Object | ||
Retourneert een tekenreeksrepresentatie van het opgegeven object. | Object | ||
Retourneert de primitieve waarde van het opgegeven object. | Object | ||
Controleert of een gebeurtenislistener is geregistreerd bij dit object EventDispatcher of een van de voorouders voor het opgegeven type gebeurtenis. | EventDispatcher |
Methode | Gedefinieerd door | ||
---|---|---|---|
Returns the most appropriate MediaFactoryItem for the specified resource
out of the MediaFactoryItems in the specified list. | MediaFactory |
Gebeurtenis | Overzicht | Gedefinieerd door | ||
---|---|---|---|---|
[uitgezonden gebeurtenis] Wordt verzonden wanneer Flash Player of de AIR-toepassing de besturingssysteemfocus krijgt en actief wordt. | EventDispatcher | |||
[uitgezonden gebeurtenis] Wordt verzonden wanneer Flash Player of de AIR-toepassing de systeemfocus verliest en inactief wordt. | 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 | eigenschap |
MediaFactory | () | Constructor |
public function MediaFactory()
Taalversie: | ActionScript 3.0 |
Productversie: | OSMF 1.0 |
Runtimeversies: | Flash Player 10, AIR 1.5 |
Constructor.
addItem | () | methode |
public function addItem(item:MediaFactoryItem):void
Taalversie: | ActionScript 3.0 |
Productversie: | OSMF 1.0 |
Runtimeversies: | 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.
Parameters
item:MediaFactoryItem — The MediaFactoryItem to add.
|
Gegenereerde uitzondering
ArgumentError — If the argument is null or if the argument
has a null ID field.
|
createMediaElement | () | methode |
public function createMediaElement(resource:MediaResourceBase):MediaElement
Taalversie: | ActionScript 3.0 |
Productversie: | OSMF 1.0 |
Runtimeversies: | 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.
Parameters
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 | () | methode |
public function getItemAt(index:int):MediaFactoryItem
Taalversie: | ActionScript 3.0 |
Productversie: | OSMF 1.0 |
Runtimeversies: | Flash Player 10, AIR 1.5 |
Gets the MediaFactoryItem at the specified index.
Parameters
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 | () | methode |
public function getItemById(id:String):MediaFactoryItem
Taalversie: | ActionScript 3.0 |
Productversie: | OSMF 1.0 |
Runtimeversies: | 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.
Parameters
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 | () | methode |
public function loadPlugin(resource:MediaResourceBase):void
Taalversie: | ActionScript 3.0 |
Productversie: | OSMF 1.0 |
Runtimeversies: | 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.
Parameters
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.
|
Gegenereerde uitzondering
ArgumentError — If resource is null or resource is neither an URLResource
nor a PluginInfoResource.
|
removeItem | () | methode |
public function removeItem(item:MediaFactoryItem):void
Taalversie: | ActionScript 3.0 |
Productversie: | OSMF 1.0 |
Runtimeversies: | Flash Player 10, AIR 1.5 |
Removes the specified MediaFactoryItem from the factory. If no such MediaFactoryItem exists in this factory, does nothing.
Parameters
item:MediaFactoryItem — The MediaFactoryItem to remove.
|
Gegenereerde uitzondering
ArgumentError — If the argument is null or if the argument
has a null ID field.
|
resolveItems | () | methode |
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".
Parameters
resource:MediaResourceBase | |
items:Vector.<MediaFactoryItem> |
MediaFactoryItem |
mediaElementCreate | Gebeurtenis |
org.osmf.events.MediaFactoryEvent
eigenschap MediaFactoryEvent.type =
org.osmf.events.MediaFactoryEvent.MEDIA_ELEMENT_CREATE
Taalversie: | ActionScript 3.0 |
Productversie: | OSMF 1.0 |
Runtimeversies: | 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 | Gebeurtenis |
org.osmf.events.MediaFactoryEvent
eigenschap MediaFactoryEvent.type =
org.osmf.events.MediaFactoryEvent.PLUGIN_LOAD
Taalversie: | ActionScript 3.0 |
Productversie: | OSMF 1.0 |
Runtimeversies: | 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 | Gebeurtenis |
org.osmf.events.MediaFactoryEvent
eigenschap MediaFactoryEvent.type =
org.osmf.events.MediaFactoryEvent.PLUGIN_LOAD_ERROR
Taalversie: | ActionScript 3.0 |
Productversie: | OSMF 1.0 |
Runtimeversies: | 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."); } } }
Wed Jun 13 2018, 11:42 AM Z