ActionScript® 3.0 Reference for the Adobe® Flash® Platform
Home  |  Show Packages and Classes List |  Packages  |  Classes  |  What's New  |  Index  |  Appendixes
org.osmf.traits 

LoaderBase  - AS3 OSMF

Packageorg.osmf.traits
Classpublic class LoaderBase
InheritanceLoaderBase Inheritance EventDispatcher Inheritance Object
Subclasses F4MLoader, ImageLoader, ManifestLoaderBase, NetLoader, SoundLoader, SWFLoader

Language Version: ActionScript 3.0
Product Version: OSMF 1.0
Runtime Versions: Flash Player 10, AIR 1.5

LoaderBase is the base class for objects that are capable of loading and unloading LoadTraits.

A MediaElement that has the LoadTrait uses a LoaderBase to perform the actual load operation. This decoupling of the loading and unloading from the media allows a MediaElement to use different loaders for different circumstances.



Public Properties
 PropertyDefined By
 Inheritedconstructor : Object
A reference to the class object or constructor function for a given object instance.
Object
Public Methods
 MethodDefined By
 Inherited
addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
Registers an event listener object with an EventDispatcher object so that the listener receives notification of an event.
EventDispatcher
  
Indicates whether this loader is capable of handling (loading) the given MediaResourceBase.
LoaderBase
 Inherited
Dispatches an event into the event flow.
EventDispatcher
 Inherited
Checks whether the EventDispatcher object has any listeners registered for a specific type of event.
EventDispatcher
 Inherited
Indicates whether an object has a specified property defined.
Object
 Inherited
Indicates whether an instance of the Object class is in the prototype chain of the object specified as the parameter.
Object
  
Loads the specified LoadTrait.
LoaderBase
 Inherited
Indicates whether the specified property exists and is enumerable.
Object
 Inherited
removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void
Removes a listener from the EventDispatcher object.
EventDispatcher
 Inherited
Sets the availability of a dynamic property for loop operations.
Object
 Inherited
Returns the string representation of this object, formatted according to locale-specific conventions.
Object
 Inherited
Returns the string representation of the specified object.
Object
  
Unloads the specified LoadTrait.
LoaderBase
 Inherited
Returns the primitive value of the specified object.
Object
 Inherited
Checks whether an event listener is registered with this EventDispatcher object or any of its ancestors for the specified event type.
EventDispatcher
Protected Methods
 MethodDefined By
  
Executes the load of the given LoadTrait.
LoaderBase
  
Executes the unload of the given LoadTrait.
LoaderBase
  
Updates the given LoadTrait with the given info, and dispatches the state change event if necessary.
LoaderBase
Events
 Event Summary Defined By
 Inherited[broadcast event] Dispatched when the Flash Player or AIR application gains operating system focus and becomes active.EventDispatcher
 Inherited[broadcast event] Dispatched when the Flash Player or AIR application operating loses system focus and is becoming inactive.EventDispatcher
  Dispatched when the state of a LoadTrait being loaded or unloaded by the LoaderBase has changed.LoaderBase
Method Detail

canHandleResource

()method
public function canHandleResource(resource:MediaResourceBase):Boolean

Language Version: ActionScript 3.0
Product Version: OSMF 1.0
Runtime Versions: Flash Player 10, AIR 1.5

Indicates whether this loader is capable of handling (loading) the given MediaResourceBase.

Parameters

resource:MediaResourceBase — The media resource in question.

Returns
Boolean — True if this loader can handle the given resource.

executeLoad

()method 
protected function executeLoad(loadTrait:org.osmf.traits:LoadTrait):void

Language Version: ActionScript 3.0
Product Version: OSMF 1.0
Runtime Versions: Flash Player 10, AIR 1.5

Executes the load of the given LoadTrait.

This method is invoked by load(). Subclasses should override this method to provide their own implementation of the load operation.

Parameters

loadTrait:org.osmf.traits:LoadTrait

executeUnload

()method 
protected function executeUnload(loadTrait:org.osmf.traits:LoadTrait):void

Language Version: ActionScript 3.0
Product Version: OSMF 1.0
Runtime Versions: Flash Player 10, AIR 1.5

Executes the unload of the given LoadTrait.

This method is invoked by unload(). Subclasses should override this method to provide their own implementation of the unload operation.

Parameters

loadTrait:org.osmf.traits:LoadTrait

load

()method 
public final function load(loadTrait:org.osmf.traits:LoadTrait):void

Language Version: ActionScript 3.0
Product Version: OSMF 1.0
Runtime Versions: Flash Player 10, AIR 1.5

Loads the specified LoadTrait. Changes the load state of the LoadTrait. Dispatches the loadStateChange event with every state change.

Typical states are LOADING while the LoadTrait is loading, READY after it has successfully completed loading, and LOAD_ERROR if it fails to complete loading.

If the LoadTrait's LoadState is LOADING or READY when the method is called, this method throws an error.

Subclasses should override the executeLoad method to perform the actual load operation.

Parameters

loadTrait:org.osmf.traits:LoadTrait — The LoadTrait to load.

Throws
IllegalOperationError IllegalOperationError If this loader cannot load the given LoadTrait (as determined by the canHandleResource() method), or if the LoadTrait's LoadState is LOADING or READY.

Related API Elements

unload

()method 
public final function unload(loadTrait:org.osmf.traits:LoadTrait):void

Language Version: ActionScript 3.0
Product Version: OSMF 1.0
Runtime Versions: Flash Player 10, AIR 1.5

Unloads the specified LoadTrait. Changes the load state of the LoadTrait. Dispatches the loaderStateChange event with every state change.

Typical states are UNLOADING while the LoadTrait is unloading, UNINITIALIZED after it has successfully completed unloading, and LOAD_ERROR if it fails to complete unloading.

If the LoadTrait's LoadState is not READY when the method is called, this method throws an error.

Subclasses should override the executeUnload method to perform the actual unload operation.

Parameters

loadTrait:org.osmf.traits:LoadTrait — The LoadTrait to unload.

Throws
IllegalOperationError IllegalOperationError If this loader cannot unload the specified LoadTrait (as determined by the canHandleResource() method), or if the LoadTrait's LoadState is not READY.

Related API Elements

updateLoadTrait

()method 
protected final function updateLoadTrait(loadTrait:org.osmf.traits:LoadTrait, newState:String):void

Language Version: ActionScript 3.0
Product Version: OSMF 1.0
Runtime Versions: Flash Player 10, AIR 1.5

Updates the given LoadTrait with the given info, and dispatches the state change event if necessary.

Parameters

loadTrait:org.osmf.traits:LoadTrait — The LoadTrait to update.
 
newState:String — The new LoadState of the LoadTrait.
Event Detail

loadStateChange

Event
Event Object Type: org.osmf.events.LoaderEvent
property LoaderEvent.type = org.osmf.events.LoaderEvent.LOAD_STATE_CHANGE

Language Version: ActionScript 3.0
Product Version: OSMF 1.0
Runtime Versions: Flash Player 10, AIR 1.5

Dispatched when the state of a LoadTrait being loaded or unloaded by the LoaderBase has changed.

The LoaderEvent.LOAD_STATE_CHANGE constant defines the value of the type property of the event object for a loadStateChange event.