LoadManager
| Kind of class: | class |
|---|---|
| Inherits from: | EventDispatcher < CoreObject |
| Implements: | |
| Version: | 06/05/07 |
| Author: | Aaron Clinger |
| Classpath: | org.casaframework.load.LoadManager |
| File last modified: | Sunday, 19 August 2007, 13:43:26 |
Chains/queues load requests together in the order added. To be used when loading multiple items of same or different type.
Example:
var mediaLoad:MediaLoad = new MediaLoad(this.loadZone_mc, "test.jpg"); var soundLoad:SoundLoad = new SoundLoad(this.soundContainer_mc, "audio.mp3"); var myLoadQueue:LoadManager = LoadManager.getInstance(); this.myLoadQueue.addLoad(mediaLoad); this.myLoadQueue.addLoad(soundLoad); this.myLoadQueue.start();
Events broadcast to listeners:
onLoadCompleted = function (loadItem:LoadInterface) {} onLoadError = function (loadItem:LoadInterface) {} Summary
Class properties
Instance properties
Instance properties inherited from EventDispatcher
Instance properties inherited from CoreObject
Class methods
Instance methods
Instance methods inherited from EventDispatcher
Instance methods inherited from CoreObject
Class properties
EVENT_LOAD_COMPLETE
static EVENT_LOAD_COMPLETE:String = 'onLoadComplete'(read,write)
EVENT_LOAD_ERROR
static EVENT_LOAD_ERROR:String = 'onLoadError'(read,write)
Class methods
Instance methods
addLoad
function addLoad (loadItem:LoadInterface,
priority:Boolean) : Void
Adds item to be loaded in order. Can also be used to change a file from/to a priority load.
Parameters:
loadItem:
Load to be added to the load queue. Can be any class that inherits from org.casaframework.load.base.LoadInterface and dispatches events
"onLoadComplete" and "onLoadError".priority:
[optional] Indicates to add item to beginning of the queue/next file to load
true, or to add it at the end of the queue false; defaults to false.isLoading
function isLoading () : Boolean
Determines whether LoadManager is in the process of loading items from the queue.
Returns:
Returns
true if the LoadManager is currently actively loading; otherwise false.removeAllLoads
function removeAllLoads () : Void
Removes all items from the load queue and cancels any currently loading.
removeLoad
function removeLoad (loadItem:LoadInterface) : Boolean
Removes item from the load queue. If file is currently loading the load is stopped.
Parameters:
loadItem:
Load to be removed from the load queue.
Returns:
Returns
true if item was successfully found and removed; otherwise false.Usage note:
Load items are automatically removed from LoadManager on load success or error.
setThreads
function setThreads (threads:Number) : Void
Defines the number of simultaneous file requests/downloads.
Parameters:
theads:
The number of threads the class will theoretically use, though most browsers cap the amount of threads and hold the other requests in a queue. Pass
0 for unlimited threads.Usage note:
Class defaults to
1 thread.start
function start () : Void
Starts or resumes loading items from the queue.
Specified by:
stop
function stop () : Void
Stops loading items from the queue after the currently loading items complete loading.
Specified by: