Packagevegas.net
Classpublic class ApplicationLoader
InheritanceApplicationLoader Inheritance ObjectFactoryLoader Inheritance Task Inheritance Object

This loader load an external file who contains a context with all object definitions, resources and configuration objects to create and manage the ECMAObjectFactory IoC container.

Example : "hello world"

1 - The top-level context eden application file : "hello_world.eden"

     objects =
     [
         {
             id        : "my_format" ,
             type      : "flash.text.TextFormat" ,
             arguments : [ { value:"arial" } , { value:24 } , { value:0xFEF292 } , { value:true } ]
         }
         ,
         {
             id         : "my_field" ,
             type       : "flash.text.TextField"  ,
             properties :
             [
                 { name : "autoSize"          , value  : "left"            } ,
                 { name : "defaultTextFormat" , ref    : "my_format"       } ,
                 { name : "text"              , value  : "HELLO WORLD"     } ,
                 { name : "x"                 , value  : 10                } ,
                 { name : "y"                 , value  : 10                }
             ]
         }
         ,
         {
             id               : "stage" ,
             type             : "flash.display.Stage"  ,
             factoryReference : "#stage" ,
             singleton        : true ,
             properties       :
             [
                 { name : "align"     , value:""        } ,
                 { name : "scaleMode" , value:"noScale" }
             ]
         }
         ,
         {
             id               : "root" ,
             type             : "flash.display.MovieClip"  ,
             factoryReference : "#root" ,
             singleton        : true ,
             properties       :
             [
                 { name : "addChild" , arguments  : [ { ref:"my_field" } ]}
             ]
         }
     ] ;
     

2 - The main source code :

     import system.events.ActionEvent;
     
     import vegas.net.ApplicationLoader;
     
     var debug:Function = function( e:Event ):void
     {
         trace( e ) ;
     }
     
     var loader:ApplicationLoader = new ApplicationLoader( "hello_world.eden" , "context/" ) ;
     
     loader.root = this ;
     
     loader.addEventListener( ActionEvent.START  , debug ) ;
     loader.addEventListener( ActionEvent.FINISH , debug ) ;
     
     loader.run() ;
     



Public Properties
 PropertyDefined By
 Inheritedcontext : String
The default context file uri value.
ObjectFactoryLoader
 Inheritedfactory : ObjectFactory
The IoC factory reference.
ObjectFactoryLoader
 InheritedfinishIt : Signaler
This signal emit when the notifyFinished method is invoked.
Task
 InheritedflashVars : FlashVars
The flashVars reference of the application.
ObjectFactoryLoader
  localization : Localization
Determinates the Localization reference of this loader.
ApplicationLoader
 Inheritedlogger : Logger
Determinates the internal Logger reference of this Loggable object.
Task
 Inheritedpath : String
The default path of the external context file.
ObjectFactoryLoader
 Inheritedphase : String
[read-only] The current phase of the action.
Task
 InheritedresourceInfo : ObjectResourceInfo
[read-only] Returns the ObjectResourceInfo object corresponding to the current resource being loaded.
ObjectFactoryLoader
 Inheritedroot : DisplayObjectContainer
The root reference of the application.
ObjectFactoryLoader
 Inheritedrunning : Boolean
[read-only] Indicates true if the process is in progress.
Task
 Inheritedstage : Stage
The Stage reference of the application.
ObjectFactoryLoader
 InheritedstartIt : Signaler
This signal emit when the notifyStarted method is invoked.
Task
 Inheritedverbose : Boolean
Switch the verbose mode of this loader.
ObjectFactoryLoader
Protected Properties
 PropertyDefined By
 Inheritedobjects : Array
The array representation of the object definitions to insert in the IoC factory container.
ObjectFactoryLoader
 Inheritedsequencer : Chain
The internal sequencer of the factory loader.
ObjectFactoryLoader
Public Methods
 MethodDefined By
  
ApplicationLoader(context:String = application.eden, path:String, factory:ObjectFactory = null, config:Config = null, localization:Localization = null)
Creates a new ApplicationLoader instance.
ApplicationLoader
 Inherited
clear():void
Clear all the resources in the loader and reset it.
ObjectFactoryLoader
 Inherited
clone():*
Returns a shallow copy of this object.
Task
 Inherited
create():void
Creates the objects.
ObjectFactoryLoader
 Inherited
isLocked():Boolean
Returns true if the object is locked.
Task
 Inherited
lock():void
Locks the object.
Task
 Inherited
Notify an ActionEvent when the process is finished.
Task
 Inherited
Notify an ActionEvent when the process is started.
Task
 Inherited
Register the current factory reference of this loader.
ObjectFactoryLoader
 Inherited
run(... arguments):void
[override] Run the process.
ObjectFactoryLoader
  
setConfigTarget(config:Config):void
Defines the Config reference of this loader.
ApplicationLoader
 Inherited
unlock():void
Unlocks the display.
Task
 Inherited
Unregister the current factory referenceof this loader.
ObjectFactoryLoader
Protected Methods
 MethodDefined By
 Inherited
addResource(resource:ObjectResource):Boolean
This method is the strategy to insert a new ObjectResource in the sequencer.
ObjectFactoryLoader
 Inherited
change(action:Action):void
Invoked when the current task in the sequencer is changed.
ObjectFactoryLoader
 Inherited
complete(action:Action = null):void
Invoked when the factory is complete.
ObjectFactoryLoader
 Inherited
setRunning(b:Boolean):void
Changes the running property value.
Task
  
Invoked when the localization of the application is changed or to update the locale object of the IoC factory configuration with the current locale object of the application.
ApplicationLoader
Property Detail
localizationproperty
localization:Localization

Determinates the Localization reference of this loader.


Implementation
    public function get localization():Localization
    public function set localization(value:Localization):void
Constructor Detail
ApplicationLoader()Constructor
public function ApplicationLoader(context:String = application.eden, path:String, factory:ObjectFactory = null, config:Config = null, localization:Localization = null)

Creates a new ApplicationLoader instance.

Parameters
context:String (default = application.eden) — The uri of the context external eden file (default "application.eden").
 
path:String — The optional path of the external context file (default "").
 
factory:ObjectFactory (default = null) — The optional ObjectFactory reference of this loader. By default the loader use the ECMAObjectFactory.getInstance() reference.
 
config:Config (default = null) — The internal parse loader class to use to load all external context files (optional EdenLoader).
 
localization:Localization (default = null)
Method Detail
setConfigTarget()method
public function setConfigTarget(config:Config):void

Defines the Config reference of this loader. If you change the factory of this loader don't forget to actualize this method.

Parameters

config:Config

updateLocalization()method 
protected function updateLocalization(e:LocalizationEvent = null):void

Invoked when the localization of the application is changed or to update the locale object of the IoC factory configuration with the current locale object of the application.

Parameters

e:LocalizationEvent (default = null)