| Package | andromeda.config |
| Class | public dynamic class Config |
| Inheritance | Config CoreObject |
Example :
import flash.text.TextField ;
import flash.text.TextFormat ;
import andromeda.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 ) ;
| Method | Defined by | ||
|---|---|---|---|
|
Config()
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 | ||
![]() |
Returns the internal
ILogger reference of this ILogable object. | CoreObject | |
![]() |
hashCode():uint
Returns a hashcode value for the object.
| CoreObject | |
|
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 | ||
![]() |
Sets the internal
ILogger reference of this ILogable object. | CoreObject | |
![]() |
toSource(indent:int = 0):String
Returns the string representation the source code of the object.
| CoreObject | |
![]() |
toString():String
Returns the string representation of this instance.
| CoreObject | |
| Config | () | constructor |
public function Config()Creates a new Config instance.
| get | () | method |
public function get(id:String):*Apply the current Config object over the specified object.
Parametersid:String — The object to fill with the current Config object.
|
* |
| getInstance | () | method |
public static function getInstance():ConfigReturns the singleton reference of this class.
ReturnsConfig —
the singleton reference of this class.
|
| init | () | method |
public function init(o:Object, id:String, callback:Function = null):voidApply the current Config object over the specified object.
Parameterso: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):voidCopy all enumerable properties in the specified passed-in object in the Config object.
Parametersconfig:Object |