| Package | br.com.stimuli.loading |
| Class | public class BulkLoader |
| Inheritance | BulkLoader flash.events.EventDispatcher |
import br.com.stimuli.loading.BulkLoader;
/ /instantiate a BulkLoader with a name : a way to reference this instance from another classes without having to set a expolicit reference on many places
var bulkLoader : BulkLoader = new BulkLoader("main loading");
// add items to be loaded
bulkLoader.add("my_xml_file.xml");
bulkLoader.add("main.swf");
// you can also use a URLRequest object
var backgroundURL : URLRequest = new URLRequest("background.jpg");
bulkLoader.add(backgroundURL);
// add event listeners for the loader itself :
// event fired when all items have been loaded
bulkLoader.addEventListener(BulkLoader.COMPLETE, onCompleteHandler);
// event fired when loading progress has been made:
bulkLoader.addEventListener(BulkLoader.PROGRESS, _onProgressHandler);
// start loading all items
bulkLoader.start();
function _onProgressHandler(evt : ProgressEvent) : void{
trace("Loaded" , evt.bytesLoaded," of ", evt.bytesTotal);
}
function onCompleteHandler(evt : ProgressEvent) : void{
trace("All items are loaeded and ready to consume");
// grab the main movie clip:
var mainMovie : MovieClip = bulkLoader.getMovieClip("main.swf");
// Get the xml object:
var mXML : XML = bulkLoader.getXML("my_xml_file.xml");
// grab the bitmap for the background image by a string:
var myBitmap : Bitmap = bulkLoader.getBitmap("background.jpg");
// grab the bitmap for the background image using the url rquest object:
var myBitmap : Bitmap = bulkLoader.getBitmap(backgroundURL);
}
// In any other class you can access those assets without having to pass around references to the bulkLoader instance.
// In another class you get get a reference to the "main loading" bulkLoader:
var mainLoader : BulkLoader = BulkLoader.getLoader("main loading");
// now grab the xml:
var mXML : XML = mainLoader.getXML("my_xml_file.xml");
// or shorter:
var mXML : XML = BulkLoader.getLoader("main loading").getXML("my_xml_file.xml");
| Property | Defined by | ||
|---|---|---|---|
| allowsAutoIDFromFileName : Boolean Determines if an autmatic id created from the file name.
| BulkLoader | ||
| AVAILABLE_EXTENSIONS : Array [static] List of all file extensions that the
BulkLoader knows how to guess. | BulkLoader | ||
| avgLatency : Number The average latency (in miliseconds) for the entire loading.
| BulkLoader | ||
| bytesLoaded : int [read-only] The sum of all bytesLoaded for each item.
| BulkLoader | ||
| bytesTotal : int [read-only] The total bytes to load.
| BulkLoader | ||
| bytesTotalCurrent : int [read-only] The sum of all bytes loaded so far.
| BulkLoader | ||
| contents : Object [read-only] Returns an object where the urls are the keys(as strings) and the loaded contents are the value for that key.
| BulkLoader | ||
| highestPriority : int [read-only] Returns the highest priority for all items in this BulkLoader instance.
| BulkLoader | ||
| id : int [read-only] The id of this bulkLoader instance
| BulkLoader | ||
| IMAGE_EXTENSIONS : Array [static] List of file extensions that will be automagically use a
Loader object for loading. | BulkLoader | ||
| isFinished : Boolean [read-only]
| BulkLoader | ||
| isRunning : Boolean [read-only] A boolean indicating if the instace has started and has not finished loading all items
| BulkLoader | ||
| items : Array [read-only] Returns a copy of all
LoadingItem in this intance. | BulkLoader | ||
| itemsLoaded : int
Number of items alrealdy loaded.
| BulkLoader | ||
| itemsTotal : int [read-only] Total number of items to load.
| BulkLoader | ||
| loadedRatio : Number [read-only]
The ratio (0->1) of items to load / items total.
| BulkLoader | ||
| logFunction : Function The function to be used in logging.
| BulkLoader | ||
| MOVIECLIP_EXTENSIONS : Array [static]
| BulkLoader | ||
| name : String [read-only]
The name by which this loader instance can be identified.
| BulkLoader | ||
| numConnections : int [read-only] The number of simultaneous connections to use.
| BulkLoader | ||
| percentLoaded : Number [read-only] The percentage (0->1) of bytes loaded.
| BulkLoader | ||
| SOUND_EXTENSIONS : Array [static] List of file extensions that will be automagically treated as sound for loading.
| BulkLoader | ||
| speed : Number [read-only]
| BulkLoader | ||
| speedAvg : Number The average speed (in kb/s) for the entire loading.
| BulkLoader | ||
| stringSubstitutions : Object The object, used as a hashed to substitute variables specified on the url used in
add. | BulkLoader | ||
| TEXT_EXTENSIONS : Array [static] List of file extensions that will be automagically treated as text for loading.
| BulkLoader | ||
| totalTime : Number Time in seconds for the whole loading.
| BulkLoader | ||
| totalWeight : int [read-only] The sum of weights in all items to load.
| BulkLoader | ||
| VIDEO_EXTENSIONS : Array [static] List of file extensions that will be automagically treated as video for loading.
| BulkLoader | ||
| weightPercent : Number [read-only] The weighted percent of items loaded(0->1).
| BulkLoader | ||
| XML_EXTENSIONS : Array [static]
| BulkLoader | ||
| Method | Defined by | ||
|---|---|---|---|
|
BulkLoader(name:String, numConnections:int, logLevel:int)
Creates a new BulkLoader object identifiable by the
name parameter. | BulkLoader | ||
|
add(url:*, props:Object = null):LoadingItem
Adds a new assets to be loaded.
| BulkLoader | ||
|
changeItemPriority(key:String, newPriority:int):Boolean
Updates the priority of item identified by key with a new value, the queue will be re resorted right away.
| BulkLoader | ||
|
clear():void
Removes this instance from the static Register of instances.
| BulkLoader | ||
|
createUniqueNamedLoader(numConnections:int, logLevel:int):BulkLoader
[static] Creates a BulkLoader instance with an unique name.
| BulkLoader | ||
|
get(key:*):LoadingItem
Used to fetch an item with a given key.
| BulkLoader | ||
|
getAVM1Movie(key:String, clearMemory:Boolean = false):AVM1Movie
Returns a
AVM1Movie object with the downloaded asset for the given key. | BulkLoader | ||
|
getBitmap(key:String, clearMemory:Boolean = false):Bitmap
Returns a Bitmap object with the downloaded asset for the given key.
| BulkLoader | ||
|
getBitmapData(key:*, clearMemory:Boolean = false):BitmapData
Returns an BitmapData object with the downloaded asset for the given key.
| BulkLoader | ||
|
getContent(key:String, clearMemory:Boolean = false):*
Returns an untyped object with the downloaded asset for the given key.
| BulkLoader | ||
|
getHttpStatus(key:*):int
Gets the http status code for the loading item identified by key.
| BulkLoader | ||
|
getLoader(name:String):BulkLoader
[static] Fetched a
BulkLoader object created with the name parameter. | BulkLoader | ||
|
getMovieClip(key:String, clearMemory:Boolean = false):MovieClip
Returns a
MovieClip object with the downloaded asset for the given key. | BulkLoader | ||
|
getNetStream(key:String, clearMemory:Boolean = false):NetStream
Returns a
NetStream object with the downloaded asset for the given key. | BulkLoader | ||
|
getNetStreamMetaData(key:String, clearMemory:Boolean = false):Object
Returns a
Object with meta data information for a given NetStream key. | BulkLoader | ||
|
getNotLoadedItems():Array
Returns items that haven't been fully loaded.
| BulkLoader | ||
|
getProgressForItems(keys:Array):BulkProgressEvent
Calculates the progress for a specific set of items.
| BulkLoader | ||
|
getSerializedData(key:*, clearMemory:Boolean = false, encodingFunction:Function = null):*
| BulkLoader | ||
|
getSound(key:*, clearMemory:Boolean = false):Sound
Returns a Sound object with the downloaded asset for the given key.
| BulkLoader | ||
|
getStats():String
If the
logLevel if lower that LOG_ERRORS(3). | BulkLoader | ||
|
getText(key:*, clearMemory:Boolean = false):String
Returns a String object with the downloaded asset for the given key.
| BulkLoader | ||
|
getUniqueName():String
[static]
| BulkLoader | ||
|
getXML(key:*, clearMemory:Boolean = false):XML
Returns an XML object with the downloaded asset for the given key.
| BulkLoader | ||
|
hasItem(key:*, searchAll:Boolean = true):Boolean
Checks if there is loaded item in this
BulkLoader. | BulkLoader | ||
|
loadNow(key:*):Boolean
Forces the item specified by key to be loaded right away.
| BulkLoader | ||
|
pause(key:*, loadsNext:Boolean = false):Boolean
Stop loading the item identified by
key. | BulkLoader | ||
|
pauseAll():void
Stops loading all items of this
BulkLoader instance. | BulkLoader | ||
|
pauseAllLoaders():void
[static] Stops loading all items from all
BulkLoader instances. | BulkLoader | ||
|
registerNewType(extension:String, atType:String, withClass:Class):Boolean
[static] Register a new file extension to be loaded as a given type.
| BulkLoader | ||
|
reload(key:*):Boolean
Forces the item specified by key to be reloaded right away.
| BulkLoader | ||
|
remove(key:*):Boolean
This will delete this item from memory.
| BulkLoader | ||
|
removeAll():void
Deletes all loading and loaded objects.
| BulkLoader | ||
|
removeAllLoaders():void
[static] Deletes all content from all instances of
BulkLoader class. | BulkLoader | ||
|
removeFailedItems():int
Removes all items that have not succesfully loaded.
| BulkLoader | ||
|
removePausedItems():Boolean
Removes all items that have been stopped.
| BulkLoader | ||
|
resume(key:*):Boolean
Resumes loading of the item.
| BulkLoader | ||
|
resumeAll():Boolean
Resumes all loading operations that were stopped.
| BulkLoader | ||
|
sortItemsByPriority():void
Updates the priority queue
| BulkLoader | ||
|
start(withConnections:int = -1):void
Start loading all items added previously
| BulkLoader | ||
|
toString():String
Returns a string identifing this loaded instace.
| BulkLoader | ||
|
whichLoaderHasItem(key:*):BulkLoader
[static] Checks which
BulkLoader has an item by the given key. | BulkLoader | ||
| Event | Summary | Defined by | ||
|---|---|---|---|---|
| Dispatched when all items have been downloaded and parsed. | BulkLoader | |||
| Dispatched on download progress by any of the items to download. | BulkLoader | |||
| Constant | Defined by | ||
|---|---|---|---|
| AVAILABLE_TYPES : Array [static]
| BulkLoader | ||
| CAN_BEGIN_PLAYING : String = "canBeginPlaying" [static]
The name of the event
| BulkLoader | ||
| CHECK_POLICY_FILE : String = "checkPolicyFile" [static]
| BulkLoader | ||
| COMPLETE : String = "complete" [static]
The name of the event
| BulkLoader | ||
| CONTEXT : String = "context" [static] An object definig the loading context for this load operario.
| BulkLoader | ||
| DEFAULT_LOG_LEVEL : int = 20 [static]The logging level
BulkLoader will use. | BulkLoader | ||
| DEFAULT_NUM_CONNECTIONS : int = 7 [static]
| BulkLoader | ||
| ERROR : String = "error" [static]
The name of the event
| BulkLoader | ||
| GENERAL_AVAILABLE_PROPS : Array [static]
| BulkLoader | ||
| HEADERS : String = "headers" [static] An array of RequestHeader objects to be used when contructing the
URLRequest object. | BulkLoader | ||
| HTTP_STATUS : String = "httpStatus" [static]
The name of the event
| BulkLoader | ||
| ID : String = "id" [static] A
String to be used to identify an item to load, can be used in any method that fetches content (as the key parameters), stops, removes and resume items. | BulkLoader | ||
| LOG_ERRORS : int = 4 [static]Will only trace errors.
| BulkLoader | ||
| LOG_INFO : int = 2 [static]Ouputs noteworthy events such as when an item is started / finished loading.
| BulkLoader | ||
| LOG_SILENT : int = 10 [static]Nothing will be logged
| BulkLoader | ||
| LOG_VERBOSE : int = 0 [static] LogLevel: Outputs everything that is happening.
| BulkLoader | ||
| LOG_WARNINGS : int = 3 [static]Ouputs noteworthy events such as when an item is started / finished loading.
| BulkLoader | ||
| MAX_TRIES : String = "maxTries" [static] The number, as an
int, to retry downloading an item in case it fails. | BulkLoader | ||
| OPEN : String = "open" [static]
The name of the event
| BulkLoader | ||
| PAUSED_AT_START : String = "pausedAtStart" [static]
| BulkLoader | ||
| PREVENT_CACHING : String = "preventCache" [static] If
true a random query (or post data parameter) will be added to prevent caching. | BulkLoader | ||
| PRIORITY : String = "priority" [static] An
int that controls which items are loaded first. | BulkLoader | ||
| PROGRESS : String = "progress" [static]
The name of the event
| BulkLoader | ||
| TYPE_IMAGE : String = "image" [static] Tells this class to use a
Loader object to load the item. | BulkLoader | ||
| TYPE_MOVIECLIP : String = "movieclip" [static] Tells this class to use a
Loader object to load the item. | BulkLoader | ||
| TYPE_SOUND : String = "sound" [static] Tells this class to use a
Sound object to load the item. | BulkLoader | ||
| TYPE_TEXT : String = "text" [static] Tells this class to use a
URLRequest object to load the item. | BulkLoader | ||
| TYPE_VIDEO : String = "video" [static] Tells this class to use a
NetStream object to load the item. | BulkLoader | ||
| TYPE_XML : String = "xml" [static] Tells this class to use a
XML object to load the item. | BulkLoader | ||
| VERSION : String = "rev 196 (0.9.9.4)" [static] Version.
| BulkLoader | ||
| WEIGHT : String = "weight" [static]
| BulkLoader | ||
| allowsAutoIDFromFileName | property |
allowsAutoIDFromFileName:Boolean [read-write]Determines if an autmatic id created from the file name. If true, when adding and item and NOT specifing an "id" props for its properties, an id with the file name will be created altomatically.
Implementation public function get allowsAutoIDFromFileName():Boolean
public function set allowsAutoIDFromFileName(value:Boolean):void
bulkLoader.allowsAutoIDFromFileName = false;
var item : LoadingItem = bulkLoader.add("background.jpg")
trace(item.id) // outputs: null
// now if allowsAutoIDFromFileName is set to true:
bulkLoader.allowsAutoIDFromFileName = true;
var item : LoadingItem = bulkLoader.add("background.jpg")
trace(item.id) // outputs: background
// if you pass an id on the props, it will take precedence over auto created ids:
bulkLoader.allowsAutoIDFromFileName = id;
var item : LoadingItem = bulkLoader.add("background.jpg", {id:"small-bg"})
trace(item.id) // outputs: small-bg
| AVAILABLE_EXTENSIONS | property |
public static var AVAILABLE_EXTENSIONS:Array List of all file extensions that the BulkLoader knows how to guess.
Availabe types: swf, jpg, jpeg, gif, png.
| avgLatency | property |
public var avgLatency:NumberThe average latency (in miliseconds) for the entire loading.
| bytesLoaded | property |
bytesLoaded:int [read-only]The sum of all bytesLoaded for each item.
Implementation public function get bytesLoaded():int
| bytesTotal | property |
bytesTotal:int [read-only]The total bytes to load. If the number of items to load is larger than the number of simultaneous connections, bytesTotal will be 0 untill all connections are opened and the number of bytes for all items is known.
Implementation public function get bytesTotal():int
See also
| bytesTotalCurrent | property |
bytesTotalCurrent:int [read-only]The sum of all bytes loaded so far. If itemsTotal is less than the number of connections, this will be the same as bytesTotal. Else, bytesTotalCurrent will be available as each loading is started.
Implementation public function get bytesTotalCurrent():int
See also
| contents | property |
contents:Object [read-only]Returns an object where the urls are the keys(as strings) and the loaded contents are the value for that key. Each value is typed as an the client must check for the right typing.
Implementation public function get contents():Object
| highestPriority | property |
highestPriority:int [read-only]Returns the highest priority for all items in this BulkLoader instance. This will check all items, including cancelled items and already downloaded items.
Implementation public function get highestPriority():int
| id | property |
id:int [read-only]The id of this bulkLoader instance
Implementation public function get id():int
| IMAGE_EXTENSIONS | property |
public static var IMAGE_EXTENSIONS:Array List of file extensions that will be automagically use a Loader object for loading.
Availabe types: swf, jpg, jpeg, gif, png, image.
| isFinished | property |
isFinished:Boolean [read-only]Implementation
public function get isFinished():Boolean
| isRunning | property |
isRunning:Boolean [read-only]A boolean indicating if the instace has started and has not finished loading all items
Implementation public function get isRunning():Boolean
| items | property |
items:Array [read-only] Returns a copy of all LoadingItem in this intance. This function makes a copy to avoid
users messing with _items (removing items and so forth). Those can be done through functions in BulkLoader.
public function get items():Array
| itemsLoaded | property |
itemsLoaded:int [read-write]Number of items alrealdy loaded. Failed or canceled items are not taken into consideration
Implementation public function get itemsLoaded():int
public function set itemsLoaded(value:int):void
| itemsTotal | property |
itemsTotal:int [read-only]Total number of items to load.
Implementation public function get itemsTotal():int
| loadedRatio | property |
loadedRatio:Number [read-only]The ratio (0->1) of items to load / items total. This number is always reliable.
Implementation public function get loadedRatio():Number
| logFunction | property |
logFunction:Function [read-write] The function to be used in logging. By default it's the same as the global function trace. The log function signature is:
public function myLogFunction(msg : String) : void{}
Implementation
public function get logFunction():Function
public function set logFunction(value:Function):void
| MOVIECLIP_EXTENSIONS | property |
public static var MOVIECLIP_EXTENSIONS:Array
| name | property |
name:String [read-only]The name by which this loader instance can be identified. This property is used so you can get a reference to this instance from other classes in your code without having to save and pass it yourself, throught the static method BulkLoader.getLoader(name) .
Each name should be unique, as instantiating a BulkLoader with a name already taken will throw an error. Implementation public function get name():String
See also
| numConnections | property |
numConnections:int [read-only] The number of simultaneous connections to use. This is per BulkLoader instance.
public function get numConnections():int
See also
| percentLoaded | property |
percentLoaded:Number [read-only]The percentage (0->1) of bytes loaded. Until all connections are opened this number is not reliable . If you are downloading more items than the number of simultaneous connections, use loadedRatio or weightPercent instead.
Implementation public function get percentLoaded():Number
See also
| SOUND_EXTENSIONS | property |
public static var SOUND_EXTENSIONS:ArrayList of file extensions that will be automagically treated as sound for loading. Availabe types: mp3, f4a, f4b.
| speed | property |
speed:Number [read-only]Implementation
public function get speed():Number
| speedAvg | property |
public var speedAvg:NumberThe average speed (in kb/s) for the entire loading.
| stringSubstitutions | property |
stringSubstitutions:Object [read-write] The object, used as a hashed to substitute variables specified on the url used in add.
Allows to keep common part of urls on one spot only. If later the server path changes, you can
change only the stringSubstitutions object to update all items.
This has to be set before the add calls are made, or else strings won't be expanded.
public function get stringSubstitutions():Object
public function set stringSubstitutions(value:Object):void
See also
// All webservices will be at a common path:
bulkLoader.stringSubstitutions = {
"web_services": "http://somesite.com/webservices"
}
bulkLoader.add("{web_services}/getTime");
// this will be expanded to http://somesite.com/webservices/getTime
| TEXT_EXTENSIONS | property |
public static var TEXT_EXTENSIONS:ArrayList of file extensions that will be automagically treated as text for loading. Availabe types: txt, js, xml, php, asp .
| totalTime | property |
public var totalTime:NumberTime in seconds for the whole loading. Only available after everything is laoded
| totalWeight | property |
totalWeight:int [read-only]The sum of weights in all items to load. Each item's weight default to 1
Implementation public function get totalWeight():int
| VIDEO_EXTENSIONS | property |
public static var VIDEO_EXTENSIONS:ArrayList of file extensions that will be automagically treated as video for loading. Availabe types: flv, f4v, f4p.
| weightPercent | property |
weightPercent:Number [read-only]The weighted percent of items loaded(0->1). This always returns a reliable value.
Implementation public function get weightPercent():Number
| XML_EXTENSIONS | property |
public static var XML_EXTENSIONS:Array
| BulkLoader | () | constructor |
public function BulkLoader(name:String, numConnections:int, logLevel:int) Creates a new BulkLoader object identifiable by the name parameter. The name parameter must be unique, else an Error will be thrown.
name:String — A name that can be used later to reference this loader in a static context,
|
|
numConnections:int — numConnections The number of maximum simultaneous connections to be open.
|
|
logLevel:int — logLevel At which level should traces be outputed. By default only errors will be traced.
|
See also
| add | () | method |
public function add(url:*, props:Object = null):LoadingItem Adds a new assets to be loaded. The BulkLoader object will manage diferent assets type. If the right type cannot be infered from the url termination (e.g. the url ends with ".swf") the BulkLoader will relly on the type property of the props parameter. If both are set, the type property of the props object will overrite the one defined in the url. In case none is specified and the url won't hint at it, the type TYPE_TEXT will be used.
url:* — String OR URLRequest A String or a URLRequest instance.
|
|||||||||||||||||||||||||||||||
props:Object (default = null) — An object specifing extra data for this loader. The following properties are supported:
|
LoadingItem |
See also
import br.stimuli.loaded.BulkLoader;
var bulkLoader : BulkLoader = new BulkLoader("main");
// simple item:
bulkLoader.add("config.xml");
// use an id that can be retirved latterL
bulkLoader.add("background.jpg", {id:"bg"});
// or use a static var to have auto-complete and static checks on your ide:
bulkLoader.add("background.jpg", {BulkLoader.ID:"bg"});
// loads the languages.xml file first and parses before all items are done:
public function parseLanguages() : void{
var theLangXML : XML = bulkLoader.getXML("langs");
// do something wih the xml:
doSomething(theLangXML);
}
bulkLoader.add("languages.xml", {priority:10, onComplete:parseLanguages, id:"langs"});
// Start the loading operation with only 3 simultaneous connections:
bulkLoader.start(3)
| changeItemPriority | () | method |
public function changeItemPriority(key:String, newPriority:int):BooleanUpdates the priority of item identified by key with a new value, the queue will be re resorted right away. Changing priorities will not stop currently opened connections.
Parameterskey:String — The url request, url as a string or a id from which the asset was loaded.
|
|
newPriority:int — The priority to assign to the item.
|
Boolean — The true if an item with that key was found, false othersiwe.
|
| clear | () | method |
public function clear():voidRemoves this instance from the static Register of instances. After a clear method has been called for a given instance, nothing else should work
| createUniqueNamedLoader | () | method |
public static function createUniqueNamedLoader(numConnections:int, logLevel:int):BulkLoaderCreates a BulkLoader instance with an unique name. This is useful for situations where you might be creating many BulkLoader instances and it gets tricky to garantee that no other instance is using that name.
ParametersnumConnections:int — numConnections The number of maximum simultaneous connections to be open.
|
|
logLevel:int — logLevel At which level should traces be outputed. By default only errors will be traced.
|
BulkLoader —
A BulkLoader intance, with an unique name.
|
| get | () | method |
public function get(key:*):LoadingItem Used to fetch an item with a given key. The returned LoadingItem can be used to attach event listeners for the individual items (Event.COMPLETE, ProgressEvent.PROGRESS, Event.START).
key:* — A url (as a string or urlrequest) or an id to fetch
|
LoadingItem —
The corresponding LoadingItem or null if one isn't found.
|
| getAVM1Movie | () | method |
public function getAVM1Movie(key:String, clearMemory:Boolean = false):AVM1Movie Returns a AVM1Movie object with the downloaded asset for the given key.
key:String — The url request, url as a string or a id from which the asset was loaded. Returns null if the cast fails
|
|
clearMemory:Boolean (default = false) — If this BulkProgressEvent instance should clear all references to the content of this asset.
|
AVM1Movie — The content retrived from that url casted to a AVM1Movie object. Returns null if the cast fails.
|
| getBitmap | () | method |
public function getBitmap(key:String, clearMemory:Boolean = false):BitmapReturns a Bitmap object with the downloaded asset for the given key.
Parameterskey:String — The url request, url as a string or a id from which the asset was loaded. Returns null if the cast fails
|
|
clearMemory:Boolean (default = false) — If this BulkProgressEvent instance should clear all references to the content of this asset.
|
Bitmap — The content retrived from that url casted to a Bitmap object. Returns null if the cast fails.
|
| getBitmapData | () | method |
public function getBitmapData(key:*, clearMemory:Boolean = false):BitmapDataReturns an BitmapData object with the downloaded asset for the given key.
Parameterskey:* — The url request, url as a string or a id from which the asset was loaded. Returns null if the cast fails. Does not clone the original bitmap data from the bitmap asset.
|
|
clearMemory:Boolean (default = false) — If this BulkProgressEvent instance should clear all references to the content of this asset.
|
BitmapData — The content retrived from that url casted to a BitmapData object. Returns null if the cast fails.
|
| getContent | () | method |
public function getContent(key:String, clearMemory:Boolean = false):*Returns an untyped object with the downloaded asset for the given key.
Parameterskey:String — The url request, url as a string or a id from which the asset was loaded.
|
|
clearMemory:Boolean (default = false) — If this BulkProgressEvent instance should clear all references to the content of this asset.
|
* — The content retrived from that url
|
| getHttpStatus | () | method |
public function getHttpStatus(key:*):intGets the http status code for the loading item identified by key.
Parameterskey:* — The url request, url as a string or a id from which the asset was loaded.
|
int — The Http status as an integer. If no item is found returns -1. If the http status cannot be determined but the item was found, returns 0.
|
| getLoader | () | method |
public static function getLoader(name:String):BulkLoader Fetched a BulkLoader object created with the name parameter.
This is usefull if you must access loades assets from another scope, without having to pass direct references to this loader.
name:String — name The name of the loader to be fetched.
|
BulkLoader —
The BulkLoader instance that was registred with that name. Returns null if none is found.
|
| getMovieClip | () | method |
public function getMovieClip(key:String, clearMemory:Boolean = false):MovieClip Returns a MovieClip object with the downloaded asset for the given key.
key:String — The url request, url as a string or a id from which the asset was loaded. Returns null if the cast fails
|
|
clearMemory:Boolean (default = false) — If this BulkProgressEvent instance should clear all references to the content of this asset.
|
MovieClip — The content retrived from that url casted to a MovieClip object. Returns null if the cast fails.
|
| getNetStream | () | method |
public function getNetStream(key:String, clearMemory:Boolean = false):NetStream Returns a NetStream object with the downloaded asset for the given key.
key:String — The url request, url as a string or a id from which the asset was loaded. Returns null if the cast fails
|
|
clearMemory:Boolean (default = false) — If this BulkProgressEvent instance should clear all references to the content of this asset.
|
NetStream — The content retrived from that url casted to a NetStream object. Returns null if the cast fails.
|
| getNetStreamMetaData | () | method |
public function getNetStreamMetaData(key:String, clearMemory:Boolean = false):Object Returns a Object with meta data information for a given NetStream key.
key:String — The url request, url as a string or a id from which the asset was loaded. Returns null if the cast fails
|
|
clearMemory:Boolean (default = false) — If this BulkProgressEvent instance should clear all references to the content of this asset.
|
Object — The meta data object downloaded with this NetStream. Returns null if the given key does not resolve to a NetStream.
|
| getNotLoadedItems | () | method |
public function getNotLoadedItems():ArrayReturns items that haven't been fully loaded.
ReturnsArray — An array with all LoadingItems not fully loaded.
|
| getProgressForItems | () | method |
public function getProgressForItems(keys:Array):BulkProgressEventCalculates the progress for a specific set of items.
Parameterskeys:Array — An Array containing keys (ids or urls) or LoadingItem objects to measure progress of.
|
BulkProgressEvent —
A BulkProgressEvent object with the current progress status.
|
See also
| getSerializedData | () | method |
public function getSerializedData(key:*, clearMemory:Boolean = false, encodingFunction:Function = null):*Parameters
key:* |
|
clearMemory:Boolean (default = false) |
|
encodingFunction:Function (default = null) |
* |
| getSound | () | method |
public function getSound(key:*, clearMemory:Boolean = false):SoundReturns a Sound object with the downloaded asset for the given key.
Parameterskey:* — key The url request, url as a string or a id from which the asset was loaded. Returns null if the cast fails
|
|
clearMemory:Boolean (default = false) — clearMemory Boolean If this BulkProgressEvent instance should clear all references to the content of this asset.
|
Sound — The content retrived from that url casted to a Sound object. Returns null if the cast fails.
|
| getStats | () | method |
public function getStats():String If the logLevel if lower that LOG_ERRORS(3). Outputs a host of statistics about the loading operation
String — A formated string with loading statistics.
|
See also
| getText | () | method |
public function getText(key:*, clearMemory:Boolean = false):StringReturns a String object with the downloaded asset for the given key.
Parameterskey:* — The url request, url as a string or a id from which the asset was loaded. Returns null if the cast fails
|
|
clearMemory:Boolean (default = false) — If this BulkProgressEvent instance should clear all references to the content of this asset.
|
String — The content retrived from that url casted to a String object. Returns null if the cast fails.
|
| getUniqueName | () | method |
public static function getUniqueName():String
Returns
String |
| getXML | () | method |
public function getXML(key:*, clearMemory:Boolean = false):XMLReturns an XML object with the downloaded asset for the given key.
Parameterskey:* — key String OR URLRequest The url request, url as a string or a id from which the asset was loaded. Returns null if the cast fails
|
|
clearMemory:Boolean (default = false) — If this BulkProgressEvent instance should clear all references to the content of this asset.
|
XML — The content retrived from that url casted to a XML object. Returns null if the cast fails.
|
| hasItem | () | method |
public function hasItem(key:*, searchAll:Boolean = true):Boolean Checks if there is loaded item in this BulkLoader.
key:* — The url (as a String or a URLRequest object)or an id (as a String) by which the item is identifiable.
|
|
searchAll:Boolean (default = true) — searchAll If true will search through all BulkLoader instances. Else will only search this one.
|
Boolean — True if a loader has a loaded item stored.
|
| loadNow | () | method |
public function loadNow(key:*):BooleanForces the item specified by key to be loaded right away. This will stop any open connection as needed. If needed, the connection to be closed will be the one with the lower priority. In case of a tie, the one that has more bytes to complete will be removed. The item to load now will be automatically be set the highest priority value in this BulkLoader instance.
Parameterskey:* — The url request, url as a string or a id from which the asset was created.
|
Boolean — True if an item with that key is found, false otherwise.
|
| pause | () | method |
public function pause(key:*, loadsNext:Boolean = false):Boolean Stop loading the item identified by key. This will not remove the item from the BulkLoader. Note that progress notification will jump around, as the stopped item will still count as something to load, but it's byte count will be 0.
key:* — The key (url as a string, url as a URLRequest or an id as a String).
|
|
loadsNext:Boolean (default = false) — If it should start loading the next item.
|
Boolean — A Boolean indicating if the object has been stopped.
|
| pauseAll | () | method |
public function pauseAll():void Stops loading all items of this BulkLoader instance. This does not clear or remove items from the qeue.
| pauseAllLoaders | () | method |
public static function pauseAllLoaders():void Stops loading all items from all BulkLoader instances.
See also
| registerNewType | () | method |
public static function registerNewType(extension:String, atType:String, withClass:Class):Boolean Register a new file extension to be loaded as a given type. This is used both in the guessing of types from the url and affects how loading is done for each type.
If you are adding an extension to be of a type you are creating, you must pass the withClass parameter, which should be a class that extends LoadingItem.
extension:String — extension The file extension to be used (can include the dot or not)
|
|
atType:String — atType Which type this extension will be associated with.
|
|
withClass:Class — withClass For new types (not new extensions) wich class that extends LoadingItem should be used to mange this item.
|
Boolean — A Boolean indicating if the new extension was registered.
|
See also
| reload | () | method |
public function reload(key:*):BooleanForces the item specified by key to be reloaded right away. This will stop any open connection as needed.
Parameterskey:* — The url request, url as a string or a id from which the asset was created.
|
Boolean — True if an item with that key is found, false otherwise.
|
| remove | () | method |
public function remove(key:*):BooleanThis will delete this item from memory. It's content will be inaccessible after that.
Parameterskey:* — A url (as a string or urlrequest) or an id to fetch
|
Boolean — True if an item with that key has been removed, and false othersiwe.
|
| removeAll | () | method |
public function removeAll():void Deletes all loading and loaded objects. This will stop all connections and delete from the cache all of it's items (no content will be accessible if removeAll is executed).
| removeAllLoaders | () | method |
public static function removeAllLoaders():void Deletes all content from all instances of BulkLoader class. This will stop any pending loading operations as well as free memory.
See also
| removeFailedItems | () | method |
public function removeFailedItems():intRemoves all items that have not succesfully loaded. After removing, it will try to restart loading if there are still items to load.
Returnsint |
| removePausedItems | () | method |
public function removePausedItems():BooleanRemoves all items that have been stopped. After removing, it will try to restart loading if there are still items to load.
ReturnsBoolean |
| resume | () | method |
public function resume(key:*):BooleanResumes loading of the item. Depending on the environment the player is running, resumed items will be able to use partialy downloaded content.
Parameterskey:* — key The url request, url as a string or a id from which the asset was loaded.
|
Boolean — If a item with that key has resumed loading.
|
| resumeAll | () | method |
public function resumeAll():BooleanResumes all loading operations that were stopped.
ReturnsBoolean — True if any item was stopped and resumed, false otherwise
|
| sortItemsByPriority | () | method |
public function sortItemsByPriority():voidUpdates the priority queue
| start | () | method |
public function start(withConnections:int = -1):voidStart loading all items added previously
ParameterswithConnections:int (default = -1) — withConnections [optional]The maximum number of connections to make at the same time. If specified, will override the parameter passed (if any) to the constructor.
|
See also
| toString | () | method |
public override function toString():StringReturns a string identifing this loaded instace.
ReturnsString |
| whichLoaderHasItem | () | method |
public static function whichLoaderHasItem(key:*):BulkLoader Checks which BulkLoader has an item by the given key.
key:* — The url (as a String or a URLRequest object)or an id (as a String) by which the item is identifiable.
|
BulkLoader —
The BulkLoader instance that has the given key or null if no key if found in any loader.
|
| complete | event |
br.com.stimuli.loading.BulkProgressEvent
Dispatched when all items have been downloaded and parsed.
| progress | event |
br.com.stimuli.loading.BulkProgressEvent
Dispatched on download progress by any of the items to download.
| AVAILABLE_TYPES | constant |
public static const AVAILABLE_TYPES:Array
| CAN_BEGIN_PLAYING | constant |
public static const CAN_BEGIN_PLAYING:String = "canBeginPlaying"The name of the event
| CHECK_POLICY_FILE | constant |
public static const CHECK_POLICY_FILE:String = "checkPolicyFile"
| COMPLETE | constant |
public static const COMPLETE:String = "complete"The name of the event
| CONTEXT | constant |
public static const CONTEXT:String = "context" An object definig the loading context for this load operario. If this item is of TYPE_SOUND, a SoundLoaderContext is expected. If it's a TYPE_IMAGE a LoaderContext should be passed. Checked when adding a new item to load.
See also
| DEFAULT_LOG_LEVEL | constant |
public static const DEFAULT_LOG_LEVEL:int = 20The logging level BulkLoader will use.
See also
| DEFAULT_NUM_CONNECTIONS | constant |
public static const DEFAULT_NUM_CONNECTIONS:int = 7
| ERROR | constant |
public static const ERROR:String = "error"The name of the event
| GENERAL_AVAILABLE_PROPS | constant |
public static const GENERAL_AVAILABLE_PROPS:Array
| HEADERS | constant |
public static const HEADERS:String = "headers" An array of RequestHeader objects to be used when contructing the URLRequest object. If the url parameter is passed as a URLRequest object it will be ignored. Checked when adding a new item to load.
See also
| HTTP_STATUS | constant |
public static const HTTP_STATUS:String = "httpStatus"The name of the event
| ID | constant |
public static const ID:String = "id" A String to be used to identify an item to load, can be used in any method that fetches content (as the key parameters), stops, removes and resume items. Checked when adding a new item to load.
See also
| LOG_ERRORS | constant |
public static const LOG_ERRORS:int = 4Will only trace errors. Defaut level
| LOG_INFO | constant |
public static const LOG_INFO:int = 2Ouputs noteworthy events such as when an item is started / finished loading.
| LOG_SILENT | constant |
public static const LOG_SILENT:int = 10Nothing will be logged
| LOG_VERBOSE | constant |
public static const LOG_VERBOSE:int = 0LogLevel: Outputs everything that is happening. Usefull for debugging.
| LOG_WARNINGS | constant |
public static const LOG_WARNINGS:int = 3Ouputs noteworthy events such as when an item is started / finished loading.
| MAX_TRIES | constant |
public static const MAX_TRIES:String = "maxTries" The number, as an int, to retry downloading an item in case it fails. Checked when adding a new item to load.
The default value is 3.
See also
| OPEN | constant |
public static const OPEN:String = "open"The name of the event
| PAUSED_AT_START | constant |
public static const PAUSED_AT_START:String = "pausedAtStart"
| PREVENT_CACHING | constant |
public static const PREVENT_CACHING:String = "preventCache" If true a random query (or post data parameter) will be added to prevent caching. Checked when adding a new item to load.
See also
| PRIORITY | constant |
public static const PRIORITY:String = "priority" An int that controls which items are loaded first. Items with a higher PRIORITY will load first. If more than one item has the same PRIORITY number, the order in which they are added will be taken into consideration. Checked when adding a new item to load.
See also
| PROGRESS | constant |
public static const PROGRESS:String = "progress"The name of the event
| TYPE_IMAGE | constant |
public static const TYPE_IMAGE:String = "image" Tells this class to use a Loader object to load the item.
| TYPE_MOVIECLIP | constant |
public static const TYPE_MOVIECLIP:String = "movieclip" Tells this class to use a Loader object to load the item.
| TYPE_SOUND | constant |
public static const TYPE_SOUND:String = "sound" Tells this class to use a Sound object to load the item.
| TYPE_TEXT | constant |
public static const TYPE_TEXT:String = "text" Tells this class to use a URLRequest object to load the item.
| TYPE_VIDEO | constant |
public static const TYPE_VIDEO:String = "video" Tells this class to use a NetStream object to load the item.
| TYPE_XML | constant |
public static const TYPE_XML:String = "xml" Tells this class to use a XML object to load the item.
| VERSION | constant |
public static const VERSION:String = "rev 196 (0.9.9.4)"Version. Useful for debugging.
| WEIGHT | constant |
public static const WEIGHT:String = "weight"