| Package | de.mightypirates.utils.interfaces |
| Interface | public interface IResourceLoader extends flash.events.IEventDispatcher |
| Implementors | ResourceLoader |
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.
| Property | Defined 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 | ||
| Method | Defined by | ||
|---|---|---|---|
|
unload():void
Unloads the resource loaded via this loader.
| IResourceLoader | ||
| Event | Summary | Defined 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 | |||
| bundle | property |
bundle:IResourceBundle [read-only]The resource bundle that was used spawned this loader.
Implementation public function get bundle():IResourceBundle
| data | property |
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.
public function get data():*
| datatype | property |
datatype:String [read-only]
The type of the loaded data, which may be one of the constants specified
in ResourceType.
public function get datatype():String
| display | property |
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.
public function get display():DisplayObject
| loaderContext | property |
loaderContext:* [read-only]Loader context used for this loading process (may be null).
Implementation public function get loaderContext():*
| priority | property |
priority:int [read-only]Priority for this loading process. May be ignored.
Implementation public function get priority():int
| request | property |
request:URLRequest [read-only]The original URLRequest used to trigger this load.
Implementation public function get request():URLRequest
| unload | () | method |
public function unload():voidUnloads the resource loaded via this loader. For some resources which do not require / allow for explicit disposal this may do nothing.
| complete | event |
flash.events.Event
Dispatched when the loader has completed loading the resource.
This event is required to be implemented by every loader implementation.
| progress | event |
flash.events.ProgressEvent
Dispatched when the loader's progress changed.
Note that some loaders may choose not to implement this event.
| resource_error | event |
de.mightypirates.utils.events.ResourceErrorEvent
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.