Packagech.capi.net
Interfacepublic interface ICompositeMassLoader extends IGlobalEventDispatcher , IEventDispatcher
Implementors CompositeMassLoader

Represents a IMassLoader encapsulator to avoid too much code.



Public Properties
 PropertyDefined By
  massLoader : IMassLoader
[read-only] Defines the IMassLoader used.
ICompositeMassLoader
  name : String
[read-only] Defines the name of the ICompositeMassLoader.
ICompositeMassLoader
Public Methods
 MethodDefined By
  
addFile(fileOrURL:Object, fileType:String = null, priority:Function = null, onOpen:Function = null, onProgress:Function = null, onComplete:Function = null, onClose:Function = null, onIOError:Function = null, onSecurityError:* = null):ILoadableFile
Creates a ILoadableFile from a url and add it to the current loading queue.
ICompositeMassLoader
  
clear(destroyAll:Boolean = true):void
Clears the loading queue of the IMassLoader and empty the references to the created ILoadableFile instances.
ICompositeMassLoader
  
createFile(fileOrURL:Object, fileType:String = null, onOpen:Function = null, onProgress:Function = null, onComplete:Function = null, onClose:Function = null, onIOError:Function = null, onSecurityError:Function = null):ILoadableFile
Creates a ILoadableFile from a url.
ICompositeMassLoader
  
Retrieves the ILoadableFile at the specified index.
ICompositeMassLoader
  
getFileByProps(props:Object, strict:Boolean = false):ILoadableFile
Retrieves the first file that matches the specified properties.
ICompositeMassLoader
  
Retrieves the number of ILoadableFile instances that have been stored.
ICompositeMassLoader
  
getFiles():Array
Retrieves all the files created by the ICompositeMassLoader.
ICompositeMassLoader
  
getFilesByProps(props:Object, strict:Boolean = false):Array
Retrieves all the files that matche the specified properties.
ICompositeMassLoader
  
start(noCache:Boolean = false):void
Starts the loading of the massive loader.
ICompositeMassLoader
  
stop():void
Stops the loading of the massive loader.
ICompositeMassLoader
Events
 Event Summary Defined By
  Dispatched when the download operation stops.ICompositeMassLoader
  Dispatched after all the files have been downloaded, even if errors occured.ICompositeMassLoader
  Dispatched when the loading of a ILoadManager is closed (eg when the loading is complete or an error has occured).ICompositeMassLoader
  Dispatched when the MassLoader starts the loading of a file.ICompositeMassLoader
  Dispatched when the loading of a ILoadManager progresses.ICompositeMassLoader
  Dispatched when the download operation commences following a call to the MassLoader.start() method.ICompositeMassLoader
  Dispatched when the loading of files with a lower priority starts.ICompositeMassLoader
  Dispatched when data is received as the download operation progresses.ICompositeMassLoader
Property Detail
massLoaderproperty
massLoader:IMassLoader  [read-only]

Defines the IMassLoader used.


Implementation
    public function get massLoader():IMassLoader
nameproperty 
name:String  [read-only]

Defines the name of the ICompositeMassLoader. If the name is null, then the ICompositeMassLoader is not registered in the global map.


Implementation
    public function get name():String

See also

Method Detail
addFile()method
public function addFile(fileOrURL:Object, fileType:String = null, priority:Function = null, onOpen:Function = null, onProgress:Function = null, onComplete:Function = null, onClose:Function = null, onIOError:Function = null, onSecurityError:* = null):ILoadableFile

Creates a ILoadableFile from a url and add it to the current loading queue. If the fileOrURL parameter is an object, all the properties will be put in the ILoadableFile.properties attribute of the created ILoadableFile.

Parameters

fileOrURL:Object — The url of the file or an Object containing at least the 'url' attribute.
 
fileType:String (default = null) — The priority of the file (must be an int). If not defined and the fileOrURL parameter is an Object, then the priority of the file will be extracted from the attribute 'priority'. If no priority is specified, then the priority will be 0.
 
priority:Function (default = null) — The type of the file. If not defined and the fileOrURL parameter is an Object, then the type will be extracted from the attribute 'type'.
 
onOpen:Function (default = null) — The Event.OPEN listener.
 
onProgress:Function (default = null) — The ProgressEvent.PROGRESS listener.
 
onComplete:Function (default = null) — The Event.COMPLETE listener.
 
onClose:Function (default = null) — The Event.CLOSE listener.
 
onIOError:Function (default = null) — The IOErrorEvent.IO_ERROR listener.
 
onSecurityError:* (default = null) — The SecurityErrorEvent.SECURITY_ERROR listener.

Returns
ILoadableFile — The created ILoadableFile.

Throws
ArgumentError If fileOrURl is null.
 
ArgumentError If — the priority is invalid.

See also

clear()method 
public function clear(destroyAll:Boolean = true):void

Clears the loading queue of the IMassLoader and empty the references to the created ILoadableFile instances.

Parameters

destroyAll:Boolean (default = true) — Defines if the CompositeMassLoader must destroy all the files before clearing them.

See also

createFile()method 
public function createFile(fileOrURL:Object, fileType:String = null, onOpen:Function = null, onProgress:Function = null, onComplete:Function = null, onClose:Function = null, onIOError:Function = null, onSecurityError:Function = null):ILoadableFile

Creates a ILoadableFile from a url.

Parameters

fileOrURL:Object — The url of the file or an Object containing at least the 'url' attribute.
 
fileType:String (default = null) — The type of the file. If not defined and the fileOrURL parameter is an Object, then the type will be extracted from the attribute 'type'.
 
onOpen:Function (default = null) — The Event.OPEN listener.
 
onProgress:Function (default = null) — The ProgressEvent.PROGRESS listener.
 
onComplete:Function (default = null) — The Event.COMPLETE listener.
 
onClose:Function (default = null) — The Event.CLOSE listener.
 
onIOError:Function (default = null) — The IOErrorEvent.IO_ERROR listener.
 
onSecurityError:Function (default = null) — The SecurityErrorEvent.SECURITY_ERROR listener.

Returns
ILoadableFile — The created ILoadableFile.

Throws
ArgumentError if — the fileOrURL parameter is not defined.

See also

getFileAt()method 
public function getFileAt(index:uint):ILoadableFile

Retrieves the ILoadableFile at the specified index.

Parameters

index:uint — The index.

Returns
ILoadableFile — The ILoadableFile.
getFileByProps()method 
public function getFileByProps(props:Object, strict:Boolean = false):ILoadableFile

Retrieves the first file that matches the specified properties.

Parameters

props:Object — An Object containing the properties to match.
 
strict:Boolean (default = false) — Defines if the check must be strict or not.

Returns
ILoadableFile — The first ILoadableFile instance that matches the properties or null.

See also

getFileCount()method 
public function getFileCount():uint

Retrieves the number of ILoadableFile instances that have been stored.

Returns
uint — The number of stored ILoadableFile.
getFiles()method 
public function getFiles():Array

Retrieves all the files created by the ICompositeMassLoader. Note that the ICompositeMassLoader register the files only if the keepFiles property is set to true.

Returns
Array — The created ILoadableFile.
getFilesByProps()method 
public function getFilesByProps(props:Object, strict:Boolean = false):Array

Retrieves all the files that matche the specified properties.

Parameters

props:Object — An Object containing the properties to match.
 
strict:Boolean (default = false) — Defines if the check must be strict or not.

Returns
Array — An Array of ILoadableFile that match the specified properties.

See also

start()method 
public function start(noCache:Boolean = false):void

Starts the loading of the massive loader.

Parameters

noCache:Boolean (default = false) — If true, then all the files contained in this ICompositeMassLoader will be added back in the IMassLoader to be reloaded. This cache has nothing to do with the useCache property of a ILoadableFile.

See also

stop()method 
public function stop():void

Stops the loading of the massive loader.

See also

Event Detail
close Event
Event Object Type: flash.events.Event
Event.type property = flash.events.Event.CLOSE

Dispatched when the download operation stops. This is following a call to the MassLoader.stop() method.

See also

complete Event  
Event Object Type: flash.events.Event
Event.type property = flash.events.Event.COMPLETE

Dispatched after all the files have been downloaded, even if errors occured.

See also

fileClose Event  
Event Object Type: ch.capi.events.MassLoadEvent
MassLoadEvent.type property = ch.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).

Event when the loading of a file stops.

See also

fileOpen Event  
Event Object Type: ch.capi.events.MassLoadEvent
MassLoadEvent.type property = ch.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.

Event when the loading of a file starts.

See also

fileProgress Event  
Event Object Type: ch.capi.events.MassLoadEvent
MassLoadEvent.type property = ch.capi.events.MassLoadEvent.FILE_PROGRESS

Dispatched when the loading of a ILoadManager progresses.

Event when the loading of a file progresses.
open Event  
Event Object Type: flash.events.Event
Event.type property = flash.events.Event.OPEN

Dispatched when the download operation commences following a call to the MassLoader.start() method.

See also

priorityChanged Event  
Event Object Type: ch.capi.events.PriorityEvent
PriorityEvent.type property = ch.capi.events.PriorityEvent.PRIORITY_CHANGED

Dispatched when the loading of files with a lower priority starts.

Event when the priority changes.

See also

progress Event  
Event Object Type: flash.events.ProgressEvent
ProgressEvent.type property = flash.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.

See also