Packagecom.acleveraddress.net.multi_loader
Classpublic class MultiLoader
InheritanceMultiLoader Inheritance AbstractClass Inheritance flash.events.EventDispatcher

The MultiLoader Class is for managing the loading of multiple assets

MultiLoader can load in images, videos, sounds, text and XML

Basic instantiation is:
var ml : MultiLoader = MultiLoader.getLoader("my_loader");

To add an asset to the queue in the simplest way, you can use:
ml.add("http://www.my_site.com/my_image.jpg", MultiLoaderTypes.IMAGE);

And once all required assets have been added, the loader should be told to begin:
ml.start();

See also

com.research_now.net.multi_loader.MultiLoaderQuickLoad
com.research_now.net.multi_loader.MultiLoader.add()
com.research_now.net.multi_loader.MultiLoader.start()


Public Properties
 PropertyDefined by
  allLoaded : Boolean
[read-only] Returns true if all items have completed loading
MultiLoader
  connections : uint = 4
Maximum number of assets (simultaneous connections) that can be downloaded at one time.
MultiLoader
  connectionsPerHost : uint = 4
MultiLoader
  debug : uint = 3
[static] Debug level
MultiLoader
  failedItems : Array
A list of all items which failed to load
MultiLoader
  items : Array
Array of all added items in loader
MultiLoader
  _name : String
Managed internally by MultiLoaderManager
MultiLoader
  name : String
[read-only] Returns the MultiLoader instance's name - may only be set when instantiating
MultiLoader
  onComplete : Function
Executed when all items have completed
MultiLoader
  onCompleteParams : Array
Parameters applied to the onComplete Function.
MultiLoader
  onProgress : Function
Executed on every progress event.
MultiLoader
  onProgressParams : Array
Parameters applied to the onUpdate Function.
MultiLoader
  percentageScale : uint = 1
[static] What the loading percentages are returned as If this is set to 100 then you'll get back an actual percent If this is set to 1 then you'll get back a value between 0-1
MultiLoader
  preventCaching : Boolean
[static] Default setting for whether files should prevent caching May be overridden by the item itself
MultiLoader
  retries : uint = 3
[static] Default setting for how many retries files should try in the event of a failure May be overridden by the item itself
MultiLoader
  startTime : uint
When the loader is started
MultiLoader
Public Methods
 MethodDefined by
  
MultiLoader(flag:Boolean = false)
This is the MultiLoader constructor, but it's not for access outside the MultiLoader library

Instead use MultiLoader.getLoader(name), eg:
var ml : MultiLoader = MultiLoader.getLoader("my_loader");
MultiLoader
  
add(path:String, type:String = "", props:Object = null, params:Object = null):MultiLoaderItem
For adding an item to the loader
MultiLoader
  
Adds an item directly to this loader
MultiLoader
  
dispose():void
Disposes this MultiLoader instance
MultiLoader
  
forceImmediateLoad(key:*):void
Once an item has been added, it may be forced into the queue immediately using this method which, if all connections are being used, removes the item with the lowest priority from the queue
MultiLoader
  
getContent(key:*, clearMemory:Boolean = false):*
Returns a MultiLoaderItem's content from its key.
MultiLoader
  
Returns a MultiLoaderItem from its key
MultiLoader
  
getLoader(name:String):MultiLoader
[static] The way to instantiate a new MultiLoader instance, or retrieve one which has already been created If the name is already in use, then that loader will be returned, otherwise a new instance will be created.
MultiLoader
  
getParams(key:*):Object
Returns a MultiLoaderItem's params from its key
MultiLoader
  
pause():void
Pauses all items so no loading takes place Any items which were partially loaded may or may not lose the bytes loaded so far, depending on the browser being used
MultiLoader
  
remove(key:*):Boolean
Remove a single item from this loader
MultiLoader
  
removeAll():void
Removes all items from this loader
MultiLoader
  
Cleans up after an item has been removed
MultiLoader
  
resume():void
Resumes all paused items Any items which were partially loaded may have to start loading from scratch, depending on the browser being used
MultiLoader
  
start():void
Starts this loader
MultiLoader
Protected Methods
 MethodDefined by
 Inherited
addEvent(item:EventDispatcher, type:String, listener:Function):void
AbstractClass
 Inherited
removeEvent(item:EventDispatcher, type:String, listener:Function):void
AbstractClass
Public Constants
 ConstantDefined by
  DEFAULT_LOADER : String = "multiloader_default_loader"
[static]
MultiLoader
Property detail
allLoadedproperty
allLoaded:Boolean  [read-only]

Returns true if all items have completed loading

Implementation
    public function get allLoaded():Boolean
connectionsproperty 
public var connections:uint = 4

Maximum number of assets (simultaneous connections) that can be downloaded at one time.

connectionsPerHostproperty 
public var connectionsPerHost:uint = 4
debugproperty 
public static var debug:uint = 3

Debug level

See also

com.research_now.net.multi_loader.utils.MultiLoaderDebug
failedItemsproperty 
public var failedItems:Array

A list of all items which failed to load

itemsproperty 
public var items:Array

Array of all added items in loader

_nameproperty 
public var _name:String

Managed internally by MultiLoaderManager

nameproperty 
name:String  [read-only]

Returns the MultiLoader instance's name - may only be set when instantiating

Implementation
    public function get name():String
onCompleteproperty 
public var onComplete:Function

Executed when all items have completed

onCompleteParamsproperty 
public var onCompleteParams:Array

Parameters applied to the onComplete Function.

onProgressproperty 
public var onProgress:Function

Executed on every progress event.

onProgressParamsproperty 
public var onProgressParams:Array

Parameters applied to the onUpdate Function.

percentageScaleproperty 
public static var percentageScale:uint = 1

What the loading percentages are returned as If this is set to 100 then you'll get back an actual percent If this is set to 1 then you'll get back a value between 0-1

preventCachingproperty 
public static var preventCaching:Boolean

Default setting for whether files should prevent caching May be overridden by the item itself

See also

com.research_now.net.multi_loader.items.MultiLoaderItem.preventCaching
retriesproperty 
public static var retries:uint = 3

Default setting for how many retries files should try in the event of a failure May be overridden by the item itself

See also

com.research_now.net.multi_loader.items.MultiLoaderItem.retries
startTimeproperty 
public var startTime:uint

When the loader is started

Constructor detail
MultiLoader()constructor
public function MultiLoader(flag:Boolean = false)

This is the MultiLoader constructor, but it's not for access outside the MultiLoader library

Instead use MultiLoader.getLoader(name), eg:
var ml : MultiLoader = MultiLoader.getLoader("my_loader");

Parameters
flag:Boolean (default = false)

See also

com.research_now.net.multi_loader.MultiLoader.getLoader()
Method detail
add()method
public function add(path:String, type:String = "", props:Object = null, params:Object = null):MultiLoaderItem

For adding an item to the loader

Parameters
path:String — The path to the resource - may be relative or absolute
 
type:String (default = "") — The type of asset to load. Not required but it is strongly advised to use this. If not then MultiLoader will attempt to guess what the file type is, defaulting to text
 
props:Object (default = null) — An object containing the specific properties for this item. If the MultiLoaderItem returned by this function is cast to the appropriate type, eg MultiLoaderImageItem then these properties may be set using strong typing.
 
params:Object (default = null)

Returns
MultiLoaderItem — The MultiLoaderItem instance that has been created.

See also

com.research_now.net.multi_loader.items.MultiLoaderItem
com.research_now.net.multi_loader.data.MultiLoaderTypes
addItem()method 
public function addItem(item:MultiLoaderItem):void

Adds an item directly to this loader

Parameters
item:MultiLoaderItem — The MultiLoaderItem to add
dispose()method 
public function dispose():void

Disposes this MultiLoader instance

forceImmediateLoad()method 
public function forceImmediateLoad(key:*):void

Once an item has been added, it may be forced into the queue immediately using this method which, if all connections are being used, removes the item with the lowest priority from the queue

Parameters
key:*
getContent()method 
public function getContent(key:*, clearMemory:Boolean = false):*

Returns a MultiLoaderItem's content from its key. The content is untyped, so should be cast as appropriate

Parameters
key:* — The key for the item to retrieve
 
clearMemory:Boolean (default = false) — Whether or not to delete the item from memory after retrieving it

Returns
*

See also

com.research_now.net.multi_loader.items.MultiLoaderItem
com.research_now.net.multi_loader.data.MultiLoaderTypes
getItem()method 
public function getItem(key:*):MultiLoaderItem

Returns a MultiLoaderItem from its key

Parameters
key:*

Returns
MultiLoaderItem
getLoader()method 
public static function getLoader(name:String):MultiLoader

The way to instantiate a new MultiLoader instance, or retrieve one which has already been created If the name is already in use, then that loader will be returned, otherwise a new instance will be created. Usage: var ml : MultiLoader = MultiLoader.getLoader("my_loader");

Parameters
name:String

Returns
MultiLoader
getParams()method 
public function getParams(key:*):Object

Returns a MultiLoaderItem's params from its key

Parameters
key:*

Returns
Object — The params property as an Object, or null if not set

See also

com.research_now.net.multi_loader.items.MultiLoaderItem
com.research_now.net.multi_loader.data.MultiLoaderTypes
pause()method 
public function pause():void

Pauses all items so no loading takes place Any items which were partially loaded may or may not lose the bytes loaded so far, depending on the browser being used

See also

com.research_now.net.multi_loader.MultiLoader.resume()
remove()method 
public function remove(key:*):Boolean

Remove a single item from this loader

Parameters
key:*

Returns
Boolean
removeAll()method 
public function removeAll():void

Removes all items from this loader

removeItem()method 
public function removeItem(evt:MultiLoaderEvent):void

Cleans up after an item has been removed

Parameters
evt:MultiLoaderEvent
resume()method 
public function resume():void

Resumes all paused items Any items which were partially loaded may have to start loading from scratch, depending on the browser being used

See also

com.research_now.net.multi_loader.MultiLoader.pause()
start()method 
public function start():void

Starts this loader

Constant detail
DEFAULT_LOADERconstant
public static const DEFAULT_LOADER:String = "multiloader_default_loader"