The AppSettings class is a singleton that holds a set of configuration
settings. Each setting consists of a key and a corresponding value.
The settings can be accessed (get and set) like properties of the
AppSettings class.
To add a setting or change the value of an existing setting, simply
define it as a property as follows:
AppSettings.getInstance().mySetting = "myValue";
To get a setting, request it as a property:
var result:String = AppSettings.getInstance().mySetting;
To delete a setting, use the delete operator:
delete AppSettings.getInstance().mySetting;
public function AppSettings(enforcer:SingletonEnforcer)
Constructs a new instance of AppSettings.
Since this class is a singleton, the constructor should
never be called directly. (This is made impossible with the instance
of the internal SingletonEnforcer class that needs to passed.)
To instantiate this class, call the static getInstance() method.
Parameters
| enforcer:SingletonEnforcer — An instance of the internal SingletonEnforcer class
to enforce a singleton
|
Throws
| — when instantiating with a 'null' argument
|
public function addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):voidParameters
| type:String |
| |
| listener:Function |
| |
| useCapture:Boolean (default = false) |
| |
| priority:int (default = 0) |
| |
| useWeakReference:Boolean (default = false) |
public function addListener(listener:IAppSettingsListener, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
Adds a listener to the AppSettings.
Parameters
| listener:IAppSettingsListener — The listener object to be added
|
| |
| useCapture:Boolean (default = false) |
| |
| priority:int (default = 0) |
| |
| useWeakReference:Boolean (default = false) |
flash_proxy override function callProperty(methodName:*, ... args):*
Catches unknown method calls.
Parameters
Returns
flash_proxy override function deleteProperty(name:*):Boolean
Deletes a property.
Parameters
Returns
public function dispatchEvent(event:Event):BooleanParameters
Returns
public static function getInstance():AppSettings
Returns the singleton instance of the AppSettings class.
Returns
flash_proxy override function getProperty(name:*):*
Returns the value that matches the value with the given name.
Parameters
| name:* — The name of the setting you want to get.
|
Returns
public function hasEventListener(type:String):BooleanParameters
Returns
flash_proxy override function hasProperty(name:*):Boolean
Checks if a property exists.
Parameters
Returns
public function load(source:*):void
Loads an xml file or data containing the key/value pairs for the settings
and fills the AppSettings. The settings loaded from the xml file are
added to the existing settings and settings with the same key are
replaced by the new settings in the xml file.
The xml file can have any name you like or could even be generated
dynamically. The structure of the nodes should look as follows:
Parameters
| source:* — The location of the xml file that contains the appsettings.
|
flash_proxy override function nextName(index:int):String
Returns the name of the next property when looping through the
collection.
Parameters
Returns
flash_proxy override function nextNameIndex(index:int):int
Returns the index of the next property while looping through the
collection with a for or for each loop.
Parameters
Returns
flash_proxy override function nextValue(index:int):*
Returns the value of the next property when looping through the
collection.
Parameters
Returns
public function removeEventListener(type:String, listener:Function, useCapture:Boolean = false):voidParameters
| type:String |
| |
| listener:Function |
| |
| useCapture:Boolean (default = false) |
public function removeListener(listener:IAppSettingsListener, useCapture:Boolean = false):void
Removes a listener from the AppSettings object.
Parameters
| listener:IAppSettingsListener — The listener object to be removed.
|
| |
| useCapture:Boolean (default = false) |
flash_proxy override function setProperty(name:*, value:*):void
Sets a property.
Parameters
public function willTrigger(type:String):BooleanParameters
Returns
Prana Framework 0.5 - 2008