Packagevegas.config
Classpublic dynamic class Config
InheritanceConfig Inheritance Object
Subclasses Locale

The dynamic Config singleton. This object is a global reference to register all external config properties.

Example :

     import flash.text.TextField ;
     import flash.text.TextFormat ;
     
     import vegas.config.Config ;
     
     var init:Object =
     {
         header :
         {
             name    : "CONFIG TEST" ,
             version : "1.0.0.0"
         }
         ,
         views :
         {
             field :
             {
                 autoSize          : "left" ,
                 defaultTextFormat : new TextFormat("Arial", 14) ,
                 text              : "hello world" ,
                 textColor         : 0x3C4DDD ,
                 x                 : 10 ,
                 y                 : 10
             }
         }
     }
     
     var conf:Config = Config.getInstance() ;
     
     // Initialize the dynamic configuration with a dynamic object.
     
     conf.map( init ) ;
     
     // target valuers with the dot notation or the get() method.
     
     trace( "conf.header.name           : " + conf.header.name ) ;
     trace( "conf.get('header.version') : " + conf.get('header.version') ) ;
     
     // initialize an object in the application with the Config.init() method
     
     var field:TextField = new TextField() ;
     
     conf.init( field , "views.field" ) ;
     
     addChild( field ) ;
     



Public Properties
 PropertyDefined By
  throwError : Boolean
Indicates if the class throws errors or return null when an error is throwing.
Config
Public Methods
 MethodDefined By
  
Config(init:Object = null)
Creates a new Config instance.
Config
  
get(id:String):*
Apply the current Config object over the specified object.
Config
  
[static] Returns the singleton reference of this class.
Config
  
init(o:Object, id:String, callback:Function = null):void
Apply the current Config object over the specified object.
Config
  
map(config:Object):void
Copy all enumerable properties in the specified passed-in object in the Config object.
Config
Property Detail
throwErrorproperty
throwError:Boolean

Indicates if the class throws errors or return null when an error is throwing.


Implementation
    public function get throwError():Boolean
    public function set throwError(value:Boolean):void
Constructor Detail
Config()Constructor
public function Config(init:Object = null)

Creates a new Config instance.

Parameters
init:Object (default = null) — A generic object containing properties with which to populate the newly instance. If this argument is null, it is ignored.
Method Detail
get()method
public function get(id:String):*

Apply the current Config object over the specified object.

Parameters

id:String — The object to fill with the current Config object.

Returns
*
getInstance()method 
public static function getInstance():Config

Returns the singleton reference of this class.

Returns
Config — the singleton reference of this class.
init()method 
public function init(o:Object, id:String, callback:Function = null):void

Apply the current Config object over the specified object.

Parameters

o:Object — The object to fill with the current Config object.
 
id:String — (optional) if this key is specified the method return the value of the specified key in the current Config object.
 
callback:Function (default = null) — (optional) The optional method to launch after the initialization over the specified object.

map()method 
public function map(config:Object):void

Copy all enumerable properties in the specified passed-in object in the Config object.

Parameters

config:Object