Packagecom.acleveraddress.net.multi_loader.items
Classpublic class MultiLoaderItem
InheritanceMultiLoaderItem Inheritance AbstractDisplay Inheritance flash.display.Sprite
SubclassesMultiLoaderImageItem, MultiLoaderSoundItem, MultiLoaderSWFItem, MultiLoaderTextItem, MultiLoaderVideoItem

This class is the basis of every loaded item. It has all the default properties which may be configured for any type of item

An items may be added to a loader in a number of ways:

The simplest way is:
var item : MultiLoaderItem = ml.add("http://www.my_site.com/my_image.jpg", MultiLoaderTypes.IMAGE, {key: 'MyItem'});
which automatically creates the item for you.

You can also cast this item more strictly, eg:
var item : MultiLoaderImageItem = ml.add("http://www.my_site.com/my_image.jpg", MultiLoaderTypes.IMAGE, {key: 'MyItem'}) as MultiLoaderImageItem;

Alternatively, you could create the item and then add it to the loader via ml.addItem()
var image : MultiLoaderImageItem = new MultiLoaderImageItem("http://www.my_site.com/my_image.jpg", MultiLoaderTypes.IMAGE, {key: 'MyItem'};
ml.addItem(image);


Another option, instead of using the weakly typed params Object, is to create the item and add its parameters as necessary, eg:
var image : MultiLoaderImageItem = new MultiLoaderImageItem("http://www.my_site.com/my_image.jpg", MultiLoaderTypes.IMAGE);
image.key = "MyItem";
image.applicationDomain = myApplicationDomain;
ml.addItem(image);


When the asset has loaded, it may be retrieved via the content property. This will return an untyped object, which should be cast as appropriate.
Item type Returns
MultiLoaderImageItem Bitmap
MultiLoaderSoundItem Sound
MultiLoaderSWFItem MovieClip
MultiLoaderTextItem String
MultiLoaderVideoItem NetStream
MultiLoaderXMLItem XML

See also

com.research_now.net.multi_loader.MultiLoader.addItem()


Public Properties
 PropertyDefined by
  attempts : uint
[read-only]
MultiLoaderItem
  bytesLoaded : Number
[read-only]
MultiLoaderItem
  bytesTotal : Number
[read-only]
MultiLoaderItem
  content : *
[read-only] When the asset is loaded the content is set to the loaded item
MultiLoaderItem
  context : LoaderContext
The LoaderContext to be used, if necessary
MultiLoaderItem
  elapsedTime : uint
[read-only]
MultiLoaderItem
  endTime : uint
[read-only]
MultiLoaderItem
  errorMessage : String
In the event of an error, this is set to the error message
MultiLoaderItem
  hasFailed : Boolean
[read-only]
MultiLoaderItem
  headers : Array
The array of headers to be sent with the request
MultiLoaderItem
  hostName : String
[read-only]
MultiLoaderItem
  index : uint
[read-only]
MultiLoaderItem
  isLoaded : Boolean
[read-only]
MultiLoaderItem
  isLoading : Boolean
[read-only]
MultiLoaderItem
  key : *
The key used to reference the item.
MultiLoaderItem
  originalPath : String
This is set to the original path, for use if preventCaching is being used as well as a key, so that the original path may still be used to return the item
MultiLoaderItem
  params : Object
The params object is for saving associated parameters into the loader item when you first create it, so that you may retrieve them later, so you don't need to reference the creation source again once it has loaded, eg

var item : MultiLoaderItem = ml.add(imageXML.source, {key: 'img_1'); item.params = {width: imageXML.width, height: imageXML.height}; ml.start(); ...
MultiLoaderItem
  path : String
The path to the resource - may be relative or absolute
MultiLoaderItem
  percentLoaded : Number
[read-only]
MultiLoaderItem
  preventCaching : Boolean
Whether this item should enforce a fresh load (true) or if it tries to load a cached version.
MultiLoaderItem
  priority : int
The priority of this item - set to 0 by default
MultiLoaderItem
  retries : uint
How many times the loader should attempt to load the item after a failure.
MultiLoaderItem
  startTime : uint
[read-only]
MultiLoaderItem
  type : String
The type of asset to load.
MultiLoaderItem
  urlRequest : URLRequest
The URLRequest created for the loading request if necessary
MultiLoaderItem
  weight : uint = 1
The loading weight to be used for analysing the loader's progress
MultiLoaderItem
Protected Properties
 PropertyDefined by
  nameToString : String
[read-only]
MultiLoaderItem
Public Methods
 MethodDefined by
  
MultiLoaderItem(path:String, type:String, props:Object = null, params:Object = null)
Create a new MultiLoaderItem
MultiLoaderItem
  
dispose():void
Disposes of this item
MultiLoaderItem
  
init():void
Called when the item has been added to the loader
MultiLoaderItem
  
load():void
Starts the item loading
MultiLoaderItem
  
onStarted():void
MultiLoaderItem
  
stopLoad():void
Stops the item from loading
MultiLoaderItem
Protected Methods
 MethodDefined by
 Inherited
added(evt:Event):void
AbstractDisplay
 Inherited
addEvent(item:EventDispatcher, type:String, listener:Function, weakReference:Boolean = true, priority:int = 0):void
AbstractDisplay
  
addListeners(item:EventDispatcher):void
MultiLoaderItem
  
completeHandler(evt:Event = null):void
MultiLoaderItem
  
httpStatusHandler(event:HTTPStatusEvent):void
MultiLoaderItem
  
ioErrorHandler(event:IOErrorEvent):void
MultiLoaderItem
  
loadingFailed(error:String):void
MultiLoaderItem
  
openHandler(event:Event):void
MultiLoaderItem
  
progressHandler(event:ProgressEvent):void
MultiLoaderItem
 Inherited
removed(evt:Event):void
AbstractDisplay
 Inherited
removeEvent(item:EventDispatcher, type:String, listener:Function):void
AbstractDisplay
 Inherited
removeIfExists(child:DisplayObject, container:DisplayObjectContainer):void
AbstractDisplay
  
removeListeners(item:EventDispatcher):void
MultiLoaderItem
 Inherited
resize(evt:Event = null):void
AbstractDisplay
  
securityErrorHandler(event:SecurityErrorEvent):void
MultiLoaderItem
Property detail
attemptsproperty
attempts:uint  [read-only]

Implementation
    public function get attempts():uint
bytesLoadedproperty 
bytesLoaded:Number  [read-only]

Implementation
    public function get bytesLoaded():Number
bytesTotalproperty 
bytesTotal:Number  [read-only]

Implementation
    public function get bytesTotal():Number
contentproperty 
content:*  [read-only]

When the asset is loaded the content is set to the loaded item

Implementation
    public function get content():*
contextproperty 
public var context:LoaderContext

The LoaderContext to be used, if necessary

elapsedTimeproperty 
elapsedTime:uint  [read-only]

Implementation
    public function get elapsedTime():uint
endTimeproperty 
endTime:uint  [read-only]

Implementation
    public function get endTime():uint
errorMessageproperty 
public var errorMessage:String

In the event of an error, this is set to the error message

hasFailedproperty 
hasFailed:Boolean  [read-only]

Implementation
    public function get hasFailed():Boolean

See also

com.research_now.net.multi_loader.items.MultiLoaderItem.retries
headersproperty 
public var headers:Array

The array of headers to be sent with the request

hostNameproperty 
hostName:String  [read-only]

Implementation
    public function get hostName():String
indexproperty 
index:uint  [read-only]Implementation
    public function get index():uint
isLoadedproperty 
isLoaded:Boolean  [read-only]

Implementation
    public function get isLoaded():Boolean
isLoadingproperty 
isLoading:Boolean  [read-only]

Implementation
    public function get isLoading():Boolean
keyproperty 
public var key:*

The key used to reference the item. If not set explicitly, the path is used

nameToStringproperty 
nameToString:String  [read-only]Implementation
    protected function get nameToString():String
originalPathproperty 
public var originalPath:String

This is set to the original path, for use if preventCaching is being used as well as a key, so that the original path may still be used to return the item

paramsproperty 
public var params:Object

The params object is for saving associated parameters into the loader item when you first create it, so that you may retrieve them later, so you don't need to reference the creation source again once it has loaded, eg

var item : MultiLoaderItem = ml.add(imageXML.source, {key: 'img_1'); item.params = {width: imageXML.width, height: imageXML.height}; ml.start(); ... (onComplete function...) var bmp : Bitmap = ml.getContent('img_1') as Bitmap; bmp.width = ml.getParams('img_1').width; bmp.height = ml.getParams('img_1').height;

pathproperty 
public var path:String

The path to the resource - may be relative or absolute

percentLoadedproperty 
percentLoaded:Number  [read-only]

Implementation
    public function get percentLoaded():Number

See also

com.research_now.net.multi_loader.MultiLoader.percentageScale
preventCachingproperty 
public var preventCaching:Boolean

Whether this item should enforce a fresh load (true) or if it tries to load a cached version. Default is set by MultiLoader.preventCaching

See also

com.research_now.net.multi_loader.MultiLoader.preventCaching
priorityproperty 
public var priority:int

The priority of this item - set to 0 by default

retriesproperty 
public var retries:uint

How many times the loader should attempt to load the item after a failure.

Default is set by MultiLoader.retries

See also

com.research_now.net.multi_loader.MultiLoader.retries
startTimeproperty 
startTime:uint  [read-only]

Implementation
    public function get startTime():uint
typeproperty 
public var type:String

The type of asset to load. Not required but it is strongly advised to use this. If not supplied then MultiLoader will attempt to ascertain the file type, defaulting to text

urlRequestproperty 
public var urlRequest:URLRequest

The URLRequest created for the loading request if necessary

weightproperty 
public var weight:uint = 1

The loading weight to be used for analysing the loader's progress

See also

com.research_now.net.multi_loader.items.MultiLoaderItemManager.weightLoaded
Constructor detail
MultiLoaderItem()constructor
public function MultiLoaderItem(path:String, type:String, props:Object = null, params:Object = null)

Create a new MultiLoaderItem

Parameters
path:String — The path to the resource - may be relative or absolute
 
type:String — 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)
Method detail
addListeners()method
protected function addListeners(item:EventDispatcher):voidParameters
item:EventDispatcher
completeHandler()method 
protected function completeHandler(evt:Event = null):voidParameters
evt:Event (default = null)
dispose()method 
public function dispose():void

Disposes of this item

httpStatusHandler()method 
protected function httpStatusHandler(event:HTTPStatusEvent):voidParameters
event:HTTPStatusEvent
init()method 
public function init():void

Called when the item has been added to the loader

ioErrorHandler()method 
protected function ioErrorHandler(event:IOErrorEvent):voidParameters
event:IOErrorEvent
load()method 
public function load():void

Starts the item loading

loadingFailed()method 
protected function loadingFailed(error:String):voidParameters
error:String
onStarted()method 
public function onStarted():void
openHandler()method 
protected function openHandler(event:Event):voidParameters
event:Event
progressHandler()method 
protected function progressHandler(event:ProgressEvent):voidParameters
event:ProgressEvent
removeListeners()method 
protected function removeListeners(item:EventDispatcher):voidParameters
item:EventDispatcher
securityErrorHandler()method 
protected function securityErrorHandler(event:SecurityErrorEvent):voidParameters
event:SecurityErrorEvent
stopLoad()method 
public function stopLoad():void

Stops the item from loading