Packagecom.bourre.load
Interfacepublic interface Loader extends ASyncCommand, Command, Runnable
SubinterfacesApplicationLoaderListener, DisplayObjectBuilderListener
ImplementorsAbstractLoader, ApplicationLoader

Player version: Flash Player 9.0
Language version: ActionScript 3.0

The Loader interface defines rules for loader implementations.



Public Methods
 MethodDefined by
 Inherited
addASyncCommandListener(listener:ASyncCommandListener, ... rest):Boolean
Adds the passed-in command listener object as listener for this command events.
ASyncCommand
  
addEventListener(type:String, listener:Object, ... rest):Boolean
Adds an event listener for the specified event type.
Loader
  
addListener(listener:Object):Boolean
Adds the passed-in listener as listener for all events dispatched by this event broadcaster.
Loader
 Inherited
execute(e:Event = null):void
Execute the request according to the current command data.
Command
 Inherited
Fires the onCommandEnd event to the listeners of this command.
ASyncCommand
  
fireOnLoadErrorEvent(message:String = null):void
Dispatches event when an error occur.
Loader
  
Dispatches event when the loading is finished.
Loader
  
Dispatches event during loading progression.
Loader
  
Dispatches event when the loading starts.
Loader
  
getName():String
Returns the loader identifier.
Loader
  
getPerCent():Number
Returns a percentage of bytes loaded and total bytes to load.
Loader
  
Returns loading strategy used by the loader.
Loader
  
getURL():URLRequest
Returns the URL used by this loader.
Loader
 Inherited
isRunning():Boolean
Returns true if this object is running.
Runnable
  
load(url:URLRequest = null, context:LoaderContext = null):void
Loads content.
Loader
  
prefixURL(prefixURL:String):void
Adds prefix to URL passed to the loader instance.
Loader
 Inherited
Removes the passed-in command listener object as listener for this command events.
ASyncCommand
  
removeEventListener(type:String, listener:Object):Boolean
Removes the passed-in listener for listening the specified event.
Loader
  
removeListener(listener:Object):Boolean
Removes the passed-in listener object from this event broadcaster.
Loader
 Inherited
run():void
Starts the asynchronous process of this runnable object.
Runnable
  
setAntiCache(b:Boolean):void
Sets the 'anticache' system to true to add timestamp value to the loaded URL.
Loader
  
setContent(content:Object):void
Uses to replace this loader content.
Loader
  
setName(name:String):void
Sets the loader identifier.
Loader
  
setURL(url:URLRequest):void
Defined from which the URL will be loaded.
Loader
Method detail
addEventListener()method
public function addEventListener(type:String, listener:Object, ... rest):Boolean

Player version: Flash Player 9.0
Language version: ActionScript 3.0

Adds an event listener for the specified event type. There is two behaviors for the addEventListener function :

  1. The passed-in listener is an object : The object is added as listener only for the specified event, the object must have a function with the same name than type or at least a handleEvent function.
  2. The passed-in listener is a function : A Delegate object is created and then added as listener for the event type. There is no restriction on the name of the function. If the rest is not empty, all elements in it is used as additional arguments into the delegate object.

Parameters
type:String — name of the event for which register the listener
 
listener:Object — object or function which will receive this event
 
... rest — additional arguments for the function listener

Returns
Booleantrue if the function have been succesfully added as listener fot the passed-in event
addListener()method 
public function addListener(listener:Object):Boolean

Player version: Flash Player 9.0
Language version: ActionScript 3.0

Adds the passed-in listener as listener for all events dispatched by this event broadcaster. The function returns true if the listener have been added at the end of the call. If the listener is already registered in this event broadcaster the function returns false.

Note : The addListener function doesn't accept functions as listener, functions could only register for a single event.

Parameters
listener:Object — the listener object to add as global listener

Returns
Booleantrue if the listener have been added during this call
fireOnLoadErrorEvent()method 
public function fireOnLoadErrorEvent(message:String = null):void

Player version: Flash Player 9.0
Language version: ActionScript 3.0

Dispatches event when an error occur.

Parameters
message:String (default = null)
fireOnLoadInitEvent()method 
public function fireOnLoadInitEvent():void

Player version: Flash Player 9.0
Language version: ActionScript 3.0

Dispatches event when the loading is finished.

fireOnLoadProgressEvent()method 
public function fireOnLoadProgressEvent():void

Player version: Flash Player 9.0
Language version: ActionScript 3.0

Dispatches event during loading progression.

fireOnLoadStartEvent()method 
public function fireOnLoadStartEvent():void

Player version: Flash Player 9.0
Language version: ActionScript 3.0

Dispatches event when the loading starts.

getName()method 
public function getName():String

Player version: Flash Player 9.0
Language version: ActionScript 3.0

Returns the loader identifier.

Returns
String — The loader identifier.
getPerCent()method 
public function getPerCent():Number

Player version: Flash Player 9.0
Language version: ActionScript 3.0

Returns a percentage of bytes loaded and total bytes to load.

Returns
Number
getStrategy()method 
public function getStrategy():LoadStrategy

Player version: Flash Player 9.0
Language version: ActionScript 3.0

Returns loading strategy used by the loader.

Returns
LoadStrategy
getURL()method 
public function getURL():URLRequest

Player version: Flash Player 9.0
Language version: ActionScript 3.0

Returns the URL used by this loader.

If 'anticache' or 'prefix' are used, returns the full qualified url.

Returns
URLRequest — The URL used by this loader.

See also

load()method 
public function load(url:URLRequest = null, context:LoaderContext = null):void

Player version: Flash Player 9.0
Language version: ActionScript 3.0

Loads content.

Parameters
url:URLRequest (default = null) — The absolute or relative URL of the content to load.
 
context:LoaderContext (default = null) — (optional) A LoaderContext object, which has properties that define the following:
  • Whether or not to check for the existence of a policy file upon loading the object
  • The ApplicationDomain for the loaded object
  • The SecurityDomain for the loaded object
prefixURL()method 
public function prefixURL(prefixURL:String):void

Player version: Flash Player 9.0
Language version: ActionScript 3.0

Adds prefix to URL passed to the loader instance.

Parameters
prefixURL:String — String ( prefix ) to insert before url value.

Example
   
   var loader : Loader = new FileLoader();
   loader.prefixURL( "config/context/" );
   loader.load( new URLRequest( "info.txt" ) );
   
The loaded url path is : config/context/info.txt

removeEventListener()method 
public function removeEventListener(type:String, listener:Object):Boolean

Player version: Flash Player 9.0
Language version: ActionScript 3.0

Removes the passed-in listener for listening the specified event. The listener could be either an object or a function.

Parameters
type:String — name of the event for which unregister the listener
 
listener:Object — object or function to be unregistered

Returns
Booleantrue if the listener have been successfully removed as listener for the passed-in event
removeListener()method 
public function removeListener(listener:Object):Boolean

Player version: Flash Player 9.0
Language version: ActionScript 3.0

Removes the passed-in listener object from this event broadcaster. The object is removed as listener for all events the broadcaster may dispatch.

Parameters
listener:Object — the listener object to remove from this event broadcaster object

Returns
Booleantrue if the object have been successfully removed from this event broadcaster
setAntiCache()method 
public function setAntiCache(b:Boolean):void

Player version: Flash Player 9.0
Language version: ActionScript 3.0

Sets the 'anticache' system to true to add timestamp value to the loaded URL. In this way, it force the re loading of content and not use the possible cache content.

Parameters
b:Booleantrue to set 'anticache' to 'on'
setContent()method 
public function setContent(content:Object):void

Player version: Flash Player 9.0
Language version: ActionScript 3.0

Uses to replace this loader content.

Parameters
content:Object — New content to set as loader content
setName()method 
public function setName(name:String):void

Player version: Flash Player 9.0
Language version: ActionScript 3.0

Sets the loader identifier.

Identifier is used to register some loader into locator.

Parameters
name:String — Loader identifier
setURL()method 
public function setURL(url:URLRequest):void

Player version: Flash Player 9.0
Language version: ActionScript 3.0

Defined from which the URL will be loaded.

Parameters
url:URLRequest — URL to load