Packagede.mightypirates.utils.interfaces
Interfacepublic interface IResourceLoader extends flash.events.IEventDispatcher
ImplementorsResourceLoader

Interface to a resource loader implementation.

In general, resource loaders may not perform any actual "loading", but simply represent an interface to the user (developer) with information on the current load state of a requested resource.

Every resource bundle will likely want to implement their own specific implementation, but there is a base class with the most rudimentary functionality available (ResourceLoader).

When implementing a IResourceBundle, be aware that the loaders generated by it are not passed on to the requesting code scope, but only used internally in the ResourceProvider class. Due to lack of pointer (ha, ha) the loader implementation returned by the resource provider class is a wrapper class, which will be populated with the final data if a load succeeds, or used to forward an error event if it fails.



Public Properties
 PropertyDefined by
  bundle : IResourceBundle
[read-only] The resource bundle that was used spawned this loader.
IResourceLoader
  data : *
[read-only] The loaded data.
IResourceLoader
  datatype : String
[read-only] The type of the loaded data, which may be one of the constants specified in ResourceType.
IResourceLoader
  display : DisplayObject
[read-only] This is only used when loading a graphics object (image or swf).
IResourceLoader
  loaderContext : *
[read-only] Loader context used for this loading process (may be null).
IResourceLoader
  priority : int
[read-only] Priority for this loading process.
IResourceLoader
  request : URLRequest
[read-only] The original URLRequest used to trigger this load.
IResourceLoader
Public Methods
 MethodDefined by
  
unload():void
Unloads the resource loaded via this loader.
IResourceLoader
Events
 EventSummaryDefined by
   Dispatched when the loader has completed loading the resource.IResourceLoader
   Dispatched when the loader's progress changed.IResourceLoader
   Dispatched when the loader cannot load the resource for any reason.IResourceLoader
Property detail
bundleproperty
bundle:IResourceBundle  [read-only]

The resource bundle that was used spawned this loader.

Implementation
    public function get bundle():IResourceBundle
dataproperty 
data:*  [read-only]

The loaded data.

The actual type of this depends on what was loaded. In most cases it will be known from the context what a loader was used for to load. If not the datatype getter should be used to decide on how to cast and handle this data.

For display objects (IMAGE, SWF) please only use the display property to add elements to stage, instead of directly adding this object, to allow for proper unloading.

Implementation
    public function get data():*
datatypeproperty 
datatype:String  [read-only]

The type of the loaded data, which may be one of the constants specified in ResourceType.

Implementation
    public function get datatype():String
displayproperty 
display:DisplayObject  [read-only]

This is only used when loading a graphics object (image or swf). In those cases it mimics what the normal Loader class does: provide a container for the actually loaded content, so that it may be added to the display list before loading completes.

May be null for some loading operations.

Please only use this object to add elements to stage, instead of directly adding the data property, to allow for proper unloading.

Implementation
    public function get display():DisplayObject
loaderContextproperty 
loaderContext:*  [read-only]

Loader context used for this loading process (may be null).

Implementation
    public function get loaderContext():*
priorityproperty 
priority:int  [read-only]

Priority for this loading process. May be ignored.

Implementation
    public function get priority():int
requestproperty 
request:URLRequest  [read-only]

The original URLRequest used to trigger this load.

Implementation
    public function get request():URLRequest
Method detail
unload()method
public function unload():void

Unloads the resource loaded via this loader. For some resources which do not require / allow for explicit disposal this may do nothing.

Event detail
completeevent 
Event object type: flash.events.Event

Dispatched when the loader has completed loading the resource.

This event is required to be implemented by every loader implementation.

progressevent  
Event object type: flash.events.ProgressEvent

Dispatched when the loader's progress changed.

Note that some loaders may choose not to implement this event.

resource_errorevent  
Event object type: de.mightypirates.utils.events.ResourceErrorEvent
ResourceErrorEvent.type property = de.mightypirates.utils.events.ResourceErrorEvent.RESOURCE_ERROR

Dispatched when the loader cannot load the resource for any reason.

This event is required to be implemented by every loader implementation.

Dispatched by ResourceLoaders if the load fails.