| Package | ch.capi.net |
| Class | public class MassLoader |
| Inheritance | MassLoader GlobalEventDispatcher flash.events.EventDispatcher |
| Implements | IMassLoader |
| Subclasses | PriorityMassLoader |
IMassLoader object. The files will be loaded
in the order of they have been added in the loading queue (FIFO). If you want to specify some priority
to the loaded files, check the PriorityMassLoader class.
It is important to note that the files won't be stored anymore after they have been completely loaded. You should
have another reference to the created ILoadManager instances to access them and prevent them to be destroyed
by the Garbage Collector.
See also
| Property | Defined By | ||
|---|---|---|---|
| alwaysDispatchProgressEvent : Boolean = true
Defines if the progress event should be dispatched each time or
only when all the number of specified parallel files are being
loaded. | MassLoader | ||
| bytesLoaded : uint [read-only]
Defines the bytes that have been loaded. | MassLoader | ||
| bytesTotal : uint [read-only]
Defines the total bytes to load. | MassLoader | ||
| closeEvent : Event [read-only]
Defines the event that happend to close the MassLoader (Event.CLOSE or Event.COMPLETE). | MassLoader | ||
![]() | dispatchGlobalEvents : Boolean
Defines if the global events must be dispatched or not. | GlobalEventDispatcher | |
| loaded : Boolean [read-only]
Defines if the ILoadManager operation is complete. | MassLoader | ||
| loadInfo : ILoadInfo [read-only]
Defines the ILoadInfo object linked to the IMassLoader. | MassLoader | ||
| loadPolicy : ILoadPolicy
Defines the ILoadPolicy to use. | MassLoader | ||
| nextFileToLoad : ILoadManager [read-only]
Defines the next file that will be extracted from the queue to be loaded. | MassLoader | ||
| numFiles : uint [read-only]
Defines the total of the files in the MassLoader. | MassLoader | ||
| numFilesLoaded : uint [read-only]
Defines the number of files loaded. | MassLoader | ||
| numFilesLoading : uint [read-only]
Defines the number of files being currently loaded. | MassLoader | ||
| numFilesOpen : uint [read-only]
Defines the number of files being currently open. | MassLoader | ||
| numFilesToLoad : uint [read-only]
Defines the number of files to load. | MassLoader | ||
| parallelFiles : uint
Defines the number of files that will be loaded simultaneously. | MassLoader | ||
| stateIdle : Boolean [read-only]
Defines if the MassLoader is idle. | MassLoader | ||
| stateLoading : Boolean [read-only]
Defines if the MassLoader is loading. | MassLoader | ||
| Property | Defined By | ||
|---|---|---|---|
| files : IList [read-only]
Defines all the files that must be loaded. | MassLoader | ||
| filesLoading : IList [read-only]
Defines the files that are currently being loaded. | MassLoader | ||
| filesQueue : IDataStructure
Defines the data structure to use for the file enqueuing. | MassLoader | ||
| Method | Defined By | ||
|---|---|---|---|
MassLoader(parallelFiles:uint = 1)
Creates a new MassLoader object. | MassLoader | ||
addFile(file:ILoadManager):void
Add a file to the loading queue. | MassLoader | ||
clear():void
Resets the MassLoader data. | MassLoader | ||
![]() | dispatchEvent(evt:Event):Boolean
Dispatches the specified Event through the listeners. | GlobalEventDispatcher | |
getFileCount():uint
Get the number of files to be loaded. | MassLoader | ||
getFiles():Array
Get the files that will be loaded. | MassLoader | ||
getStaticIndexOf(file:ILoadManager):int
Retrieves the static index of the specified ILoadManager. | MassLoader | ||
hasFile(file:ILoadManager):Boolean
Retrieves if a file is contained in the loading queue. | MassLoader | ||
removeFile(file:ILoadManager):void
Removes a file from the loading queue. | MassLoader | ||
start():Boolean
Starts downloading data from the specified ILoadManager objects. | MassLoader | ||
stop():void
Stops the load operation in progress. | MassLoader | ||
toString():String
Lists all the files contained in this MassLoader in a String. | MassLoader | ||
| Method | Defined By | ||
|---|---|---|---|
Creates a MassLoadEvent based on the specified ILoadManager. | MassLoader | ||
getFileQueueIndex(file:ILoadManager):int
Retrieves the index of a file in the loading queue (if the loading of the specified file has been started). | MassLoader | ||
isComplete():Boolean
Defines if the massive loading is complete. | MassLoader | ||
loadFile(file:ILoadManager):Boolean
Start the loading of a file. | MassLoader | ||
Start the loading of the next file. | MassLoader | ||
onClose(evt:Event):void
Event.CLOSE listener. | MassLoader | ||
onComplete(evt:Event):void
Event.COMPLETE listener. | MassLoader | ||
onIOError(evt:IOErrorEvent):void
IOErrorEvent.IO_ERROR listener. | MassLoader | ||
onOpen(evt:Event):void
Event.OPEN listener. | MassLoader | ||
onProgress(evt:ProgressEvent):void
ProgressEvent.PROGRESS listener. | MassLoader | ||
onSecurityError(evt:SecurityErrorEvent):void
SecurityError.SECURITY_ERROR listener. | MassLoader | ||
Processes the loading policy on the currently closed file. | MassLoader | ||
Process the loading policy on the currently file that is being open. | MassLoader | ||
registerTo(file:ILoadManager):void
Register the MassLoader to the specified ILoadManager
object's events. | MassLoader | ||
startLoading():void
Start the loading of the files. | MassLoader | ||
unregisterFrom(file:ILoadManager):void
Unregister the MassLoader from the specified ILoadManager
object's events. | MassLoader | ||
updateBytes():void
Updates the bytesLoaded and bytesTotal values. | MassLoader | ||
| Event | Summary | Defined By | ||
|---|---|---|---|---|
| Dispatched when the download operation stops. | MassLoader | |||
| Dispatched after all the data is received. | MassLoader | |||
| Dispatched when the loading of a ILoadManager is closed (eg when the loading is complete or an error has occured). | MassLoader | |||
| Dispatched when the MassLoader starts the loading of a file. | MassLoader | |||
| Dispatched when the loading of a ILoadManager progresses. | MassLoader | |||
![]() | Dispatched after an event is dispatched. | GlobalEventDispatcher | ||
![]() | Dispatched before an event is dispatched. | GlobalEventDispatcher | ||
| Dispatched when the download operation commences following a call to the MassLoader.start() method. | MassLoader | |||
| Dispatched when data is received as the download operation progresses. | MassLoader | |||
| alwaysDispatchProgressEvent | property |
public var alwaysDispatchProgressEvent:Boolean = trueDefines if the progress event should be dispatched each time or only when all the number of specified parallel files are being loaded.
| bytesLoaded | property |
bytesLoaded:uint [read-only] Defines the bytes that have been loaded.
public function get bytesLoaded():uint| bytesTotal | property |
bytesTotal:uint [read-only] Defines the total bytes to load.
public function get bytesTotal():uint| closeEvent | property |
closeEvent:Event [read-only]
Defines the event that happend to close the MassLoader (Event.CLOSE or Event.COMPLETE). This
value is null if the MassLoader has not be started or is currently loading files.
public function get closeEvent():Event| files | property |
files:IList [read-only] Defines all the files that must be loaded.
Note that a file can be in the files list and not in the queue list. It means
that the file is currently being loaded. After being loaded, the file is totally
removed from the MassLoader.
protected function get files():IList| filesLoading | property |
filesLoading:IList [read-only]
Defines the files that are currently being loaded. This list conaints only the files
that dispatches the Event.OPEN event.
protected function get filesLoading():IListSee also
| filesQueue | property |
filesQueue:IDataStructure [read-write]
Defines the data structure to use for the file enqueuing. By default, a
QueueList is used. The MassLoader will use this
IDataStructure to retrieves the next file to load. All the objects
contained in the list must implement the ILoadManager interface.
protected function get filesQueue():IDataStructure protected function set filesQueue(value:IDataStructure):voidSee also
| loaded | property |
loaded:Boolean [read-only]
Defines if the ILoadManager operation is complete. This
value is true when all the files have been loaded (successfully or not).
public function get loaded():Boolean| loadInfo | property |
loadInfo:ILoadInfo [read-only]
Defines the ILoadInfo object linked to the IMassLoader. You can
just trace this value if you want to have some useful information.
public function get loadInfo():ILoadInfo
function onLoadProgress(evt:ProgressEvent):void
{
trace(evt.target.loadInfo);
}
myMassLoader.addEventListener(ProgressEvent.PROGRESS, onLoadProgress);
| loadPolicy | property |
loadPolicy:ILoadPolicy [read-write]
Defines the ILoadPolicy to use. If the specified ILoadPolicy returns a
ILoadManager, then the loaded bytes of the current file are decremented from the
bytesLoaded and bytesTotal properties !
public function get loadPolicy():ILoadPolicy public function set loadPolicy(value:ILoadPolicy):void| nextFileToLoad | property |
nextFileToLoad:ILoadManager [read-only] Defines the next file that will be extracted from the queue to be loaded.
public function get nextFileToLoad():ILoadManager| numFiles | property |
numFiles:uint [read-only]
Defines the total of the files in the MassLoader. This value will remain constant
after the loading has been started event if files are added.
public function get numFiles():uint| numFilesLoaded | property |
numFilesLoaded:uint [read-only] Defines the number of files loaded. This value contains also the files that have not been loaded successfully.
public function get numFilesLoaded():uint| numFilesLoading | property |
numFilesLoading:uint [read-only]
Defines the number of files being currently loaded. This value does not take care if the
Event.OPEN event of each file has been launched. It is based on the
MassLoadEvent.FILE_OPEN event.
public function get numFilesLoading():uintSee also
| numFilesOpen | property |
numFilesOpen:uint [read-only]
Defines the number of files being currently open. This value is based on the files that
have sent the Event.OPEN event.
public function get numFilesOpen():uintSee also
| numFilesToLoad | property |
numFilesToLoad:uint [read-only] Defines the number of files to load. Once a file start its loading, it is no considered in this value anymore.
public function get numFilesToLoad():uint| parallelFiles | property |
parallelFiles:uint [read-write] Defines the number of files that will be loaded simultaneously. If the value is changed during a load process, this won't affect it.
public function get parallelFiles():uint public function set parallelFiles(value:uint):void| stateIdle | property |
stateIdle:Boolean [read-only]
Defines if the MassLoader is idle.
public function get stateIdle():Boolean| stateLoading | property |
stateLoading:Boolean [read-only]
Defines if the MassLoader is loading.
public function get stateLoading():Boolean| MassLoader | () | Constructor |
public function MassLoader(parallelFiles:uint = 1)
Creates a new MassLoader object.
parallelFiles:uint (default = 1) — The number of files to be loaded simultaneously.
|
| addFile | () | method |
public function addFile(file:ILoadManager):void
Add a file to the loading queue. A file added while the MassLoader
is already running will not be added to the current loading queue. You should stop
and restart the MassLoader in order to include the file in the loading.
Parameters
file:ILoadManager — The file to add.
|
flash.errors:IllegalOperationError If — the file is already in the loading queue.
|
See also
| clear | () | method |
public function clear():void
Resets the MassLoader data. This method will clear
the index values and the current loading queue. The current files
being loaded won't be affected.
| createMassLoadEvent | () | method |
protected function createMassLoadEvent(file:ILoadManager, type:String, evt:Event = null):MassLoadEvent
Creates a MassLoadEvent based on the specified ILoadManager.
Parameters
file:ILoadManager — The ILoadManager.
| |
type:String — The MassLoadEvent type. This value can be MassLoadEvent.FILE_OPEN
or MassLoadEvent.FILE_CLOSE.
| |
evt:Event (default = null) — The close event, if any.
|
MassLoadEvent — The created MassLoadEvent.
|
| getFileCount | () | method |
public function getFileCount():uintGet the number of files to be loaded.
Returnsuint — The number of file to load.
|
| getFileQueueIndex | () | method |
protected function getFileQueueIndex(file:ILoadManager):intRetrieves the index of a file in the loading queue (if the loading of the specified file has been started).
Parameters
file:ILoadManager — The ILoadManager.
|
int — The index in the loading queue or -1.
|
| getFiles | () | method |
public function getFiles():ArrayGet the files that will be loaded.
ReturnsArray — An Array containing the files to load.
|
| getStaticIndexOf | () | method |
public function getStaticIndexOf(file:ILoadManager):int
Retrieves the static index of the specified ILoadManager. This index is attached to the ILoadManager
when it is added to the loading queue and won't change even if files are removed. In order to reset the static index list, you
must call the clear() method.
Parameters
file:ILoadManager — The ILoadManager.
|
int — The static index of the file or -1 if the file is not in the loading queue.
|
| hasFile | () | method |
public function hasFile(file:ILoadManager):BooleanRetrieves if a file is contained in the loading queue.
Parameters
file:ILoadManager — The ILoadManager.
|
Boolean — true if the file is in the loading queue.
|
| isComplete | () | method |
protected function isComplete():Boolean
Defines if the massive loading is complete. This method will return true if there is no more
file in the loading queue and there is currently no file loading.
Boolean — true if all the files are loaded.
|
See also
| loadFile | () | method |
protected final function loadFile(file:ILoadManager):Boolean
Start the loading of a file. The file specified will not be removed from the loading queue !
This method won't start the loading if the ILoadPolicy returns null.
Parameters
file:ILoadManager — The ILoadManager to load.
|
Boolean — true if the loading has been started.
|
See also
| loadNextFile | () | method |
protected function loadNextFile():ILoadManager
Start the loading of the next file. If there is no more file to load,
then a null value is returned. Before the next file is being loaded,
it is removed from the loading queue.
ILoadManager — The ILoadManager object being loaded or null.
|
| onClose | () | method |
protected final function onClose(evt:Event):void
Event.CLOSE listener.
Parameters
evt:Event — The event object.
|
| onComplete | () | method |
protected final function onComplete(evt:Event):void
Event.COMPLETE listener.
Parameters
evt:Event — The event object.
|
| onIOError | () | method |
protected final function onIOError(evt:IOErrorEvent):void
IOErrorEvent.IO_ERROR listener.
Parameters
evt:IOErrorEvent — The event object.
|
| onOpen | () | method |
protected final function onOpen(evt:Event):void
Event.OPEN listener. If the MassLoader has not been closed,
the current file being open will be added to the filesLoading list.
Parameters
evt:Event — The event object.
|
| onProgress | () | method |
protected final function onProgress(evt:ProgressEvent):void
ProgressEvent.PROGRESS listener.
Parameters
evt:ProgressEvent — The event object.
|
| onSecurityError | () | method |
protected final function onSecurityError(evt:SecurityErrorEvent):void
SecurityError.SECURITY_ERROR listener.
Parameters
evt:SecurityErrorEvent — The event object.
|
| processClosePolicy | () | method |
protected function processClosePolicy(file:ILoadManager, closeEvent:Event):ILoadManagerProcesses the loading policy on the currently closed file.
Parameters
file:ILoadManager — The ILoadManager just closed.
| |
closeEvent:Event — The event that occured.
|
ILoadManager — The ILoadManager that must be reloaded or null.
|
| processOpenPolicy | () | method |
protected function processOpenPolicy(file:ILoadManager):ILoadManager
Process the loading policy on the currently file that is being open. At this point,
the file hasn't been open and isn't registered in the MassLoader.
Parameters
file:ILoadManager — The ILoadManager that must be loaded.
|
ILoadManager — The ILoadManager that must be loaded or null if the specified
ILoadManager shouldn't be loaded.
|
| registerTo | () | method |
protected function registerTo(file:ILoadManager):void
Register the MassLoader to the specified ILoadManager
object's events.
Parameters
file:ILoadManager — The file to register to.
|
See also
| removeFile | () | method |
public function removeFile(file:ILoadManager):voidRemoves a file from the loading queue.
Parameters
file:ILoadManager — The file to remove.
|
flash.errors:IllegalOperationError If — the file is not in the loading queue.
|
See also
| start | () | method |
public final function start():Boolean
Starts downloading data from the specified ILoadManager objects.
Boolean — true if there is any file in the loading queue, false otherwise. In
any cases, the events Event.OPEN and Event.COMPLETE will be dispatched.
|
flash.errors:IllegalOperationError If — the MassLoader is already loading.
|
| startLoading | () | method |
protected function startLoading():void
Start the loading of the files. This method will launch the loading of the files (using
the loadNextFile() method). The number of loading launched is determined by
the parallelFiles value.
See also
| stop | () | method |
public final function stop():voidStops the load operation in progress. Any load operation in progress is immediately terminated.
flash.errors:IllegalOperationError If — the MassLoader is not loading.
|
| toString | () | method |
override public function toString():String
Lists all the files contained in this MassLoader in a String.
String — A String containing all the files.
|
| unregisterFrom | () | method |
protected function unregisterFrom(file:ILoadManager):void
Unregister the MassLoader from the specified ILoadManager
object's events.
Parameters
file:ILoadManager — The file to unregister from.
|
See also
| updateBytes | () | method |
protected final function updateBytes():void
Updates the bytesLoaded and bytesTotal values.
| close | Event |
flash.events.Eventflash.events.Event.CLOSE
Dispatched when the download operation stops. This is following a call to the MassLoader.stop()
method.
| complete | Event |
flash.events.Eventflash.events.Event.COMPLETEDispatched after all the data is received.
| fileClose | Event |
ch.capi.events.MassLoadEventch.capi.events.MassLoadEvent.FILE_CLOSE
Dispatched when the loading of a ILoadManager is closed (eg when the loading is complete or
an error has occured).
| fileOpen | Event |
ch.capi.events.MassLoadEventch.capi.events.MassLoadEvent.FILE_OPEN
Dispatched when the MassLoader starts the loading of a file. This event
is dispatched just before the ILoadManager.start() method is called.
| fileProgress | Event |
ch.capi.events.MassLoadEventch.capi.events.MassLoadEvent.FILE_PROGRESS
Dispatched when the loading of a ILoadManager progresses. This is just an encapsulation of
the global ProgressEvent.PROGRESS event of the MassLoader.
| open | Event |
flash.events.Eventflash.events.Event.OPEN
Dispatched when the download operation commences following a call to the MassLoader.start()
method.
| progress | Event |
flash.events.ProgressEventflash.events.ProgressEvent.PROGRESS
Dispatched when data is received as the download operation progresses. The bytesTotal and bytesLoaded
value are based on the overall progressing of the files stored in the loading queue. If the bytesTotal of a
ILoadableFile has not been retrieved, then the virtualBytesTotal value will be used.