LowRA API Documentation Annexes |  All Packages |  All Classes |  Index |  Frames
Application Display Loader  
 

Summary

  1. <application-loader> node
  2. Callback implementations
  3. Build Display loader

 

<application-loader> node

Display object loader is defined using the <application-loader> node in xml context file.
You can see full note properties on the Assembler References document.

Loader can listen many application events like :

This is a full definition for a <application-loader> node which listen all applications events. :

<application-loader url="loader.swf" 
start-callback="onStartApplication"
name-callback="onNameCallback"

load-callback="onLoadCallback"
progress-callback="onProgressCallback"
timeout-callback="onTimeoutCallback"
error-callback="onErrorCallback"
init-callback="onInitCallback"

parsed-callback="onParsedCallback"
objects-built-callback="onBuiltCallback"
channels-assigned-callback="onChannelsCallback"
methods-call-callback="onMethodsCallback"

complete-callback="onCompleteCallback"
/>

Define only callbacks you want, but when it defined, callback method name must be defined into the loader.swf content.
Let's see differents callbacks signature.

 

Callback implementations

Here is the list of all callbacks signature to be compliant with IoC loading system.
The name of the methods depends on what has been indicated in the xml context; but this the default one.

function onStartApplication( url : String, size : uint = 0 ) : void;
              
function onNameCallback( state : String ) : void;
function onLoadCallback( url : String ) : void;
function onProgressCallback( url : String, percent : Number ) : void;
function onTimeoutCallback( url : String ) : void;
function onErrorCallback( url : String ) : void;
function onInitCallback( url : String ) : void;
function onParsedCallback( ) : void;
function onBuiltCallback( ) : void;
function onChannelsCallback( ) : void;
function onMethodsCallback( ) : void;
function onCompleteCallback( ) : void;

Build Display loader

LowRA offers tools to build quickly a clean display loader.
In Flash or in pure Actionscript code, the class AbstractDisplayLoader or the interface DisplayLoader gives really great helpers.
( contained in the com.bourre.ioc.assembler.displayobject.loader package )

First thing to do, is to create a concrete implementation of the loader class.
2 possibilities :

  1. extends the abstract class AbstractDisplayLoader and override methods you need.
  2. implements the interface DisplayLoader and implements methods you need.

Using these helpers, callback names are default as example, so you don't have to deal with name association.
This an example of a concrete implementation of AbstractDisplayLoader :

public class CustomDisplayLoader extends AbstractDisplayLoader
{

public function CustomDisplayLoader()
{
}


override public function onStartApplication( url : String, size : uint = 0 ) : void
{ PixlibDebug.INFO( "IoC start processing on " + url + " for " + size + " elements" );
}

override public function onNameCallback( state : String ) : void
{ PixlibDebug.INFO( "IoC processing state change to " + state );
}

override public function onLoadCallback( url : String ) : void
{ PixlibDebug.INFO( "IoC start loading " + url + " element" );
}

override public function onProgressCallback( url : String, percent : Number ) : void
{ PixlibDebug.INFO( "IoC loading progression for " + url + " = " + percent );
}

override public function onTimeoutCallback( url : String ) : void
{ PixlibDebug.INFO( "IoC loading timeout for " + url );
}

override public function onErrorCallback( url : String ) : void
{ PixlibDebug.INFO( "IoC loading error for " + url );
}

override public function onInitCallback( url : String ) : void
{ PixlibDebug.INFO( "IoC loading finished for " + url );
}

override public function onParsedCallback( ) : void
{ PixlibDebug.INFO( "IoC context parsed" );
}

override public function onBuiltCallback( ) : void
{ PixlibDebug.INFO( "IoC objects built" );
}

override public function onChannelsCallback( ) : void
{ PixlibDebug.INFO( "IoC channels assigned" );
}

override public function onMethodsCallback( ) : void
{ PixlibDebug.INFO( "IoC methods called" );
}

override public function onCompleteCallback( ) : void
{ PixlibDebug.INFO( "IoC engine completed" );
}

Of course, you don't have to override all methods, but just needed ones.

As AbstractDisplayLoader extends MovieClip class, you can use our IDE to compile and create the loader.swf like classic swf file.
If you use the Flash IDE, just define the new CustomDispayLoader as Document class of your swf and compile.

AbstractDisplayLoader and DisplayLoader are not coupled with LowRA API, so loader still really light.

More informations about LowRA helpers on API documentation :