Packageorg.pranaframework.config
Classpublic dynamic class AppSettings
InheritanceAppSettings Inheritance flash.utils.Proxy
Implementsflash.events.IEventDispatcher

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 Methods
 MethodDefined by
  
AppSettings(enforcer:SingletonEnforcer)
Constructs a new instance of AppSettings.
AppSettings
  
addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
AppSettings
  
addListener(listener:IAppSettingsListener, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
Adds a listener to the AppSettings.
AppSettings
  
dispatchEvent(event:Event):Boolean
AppSettings
  
[static] Returns the singleton instance of the AppSettings class.
AppSettings
  
hasEventListener(type:String):Boolean
AppSettings
  
load(source:*):void
Loads an xml file or data containing the key/value pairs for the settings and fills the AppSettings.
AppSettings
  
removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void
AppSettings
  
removeListener(listener:IAppSettingsListener, useCapture:Boolean = false):void
Removes a listener from the AppSettings object.
AppSettings
  
willTrigger(type:String):Boolean
AppSettings
Protected Methods
 MethodDefined by
  
callProperty(methodName:*, ... args):*
Catches unknown method calls.
AppSettings
  
deleteProperty(name:*):Boolean
Deletes a property.
AppSettings
  
getProperty(name:*):*
Returns the value that matches the value with the given name.
AppSettings
  
hasProperty(name:*):Boolean
Checks if a property exists.
AppSettings
  
nextName(index:int):String
Returns the name of the next property when looping through the collection.
AppSettings
  
nextNameIndex(index:int):int
Returns the index of the next property while looping through the collection with a for or for each loop.
AppSettings
  
nextValue(index:int):*
Returns the value of the next property when looping through the collection.
AppSettings
  
setProperty(name:*, value:*):void
Sets a property.
AppSettings
Constructor detail
AppSettings()constructor
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
Method detail
addEventListener()method
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)
addListener()method 
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)
callProperty()method 
flash_proxy override function callProperty(methodName:*, ... args):*

Catches unknown method calls.

Parameters
methodName:*
 
... args

Returns
*
deleteProperty()method 
flash_proxy override function deleteProperty(name:*):Boolean

Deletes a property.

Parameters
name:*

Returns
Boolean
dispatchEvent()method 
public function dispatchEvent(event:Event):BooleanParameters
event:Event

Returns
Boolean
getInstance()method 
public static function getInstance():AppSettings

Returns the singleton instance of the AppSettings class.

Returns
AppSettings
getProperty()method 
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
*
hasEventListener()method 
public function hasEventListener(type:String):BooleanParameters
type:String

Returns
Boolean
hasProperty()method 
flash_proxy override function hasProperty(name:*):Boolean

Checks if a property exists.

Parameters
name:*

Returns
Boolean
load()method 
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.
nextName()method 
flash_proxy override function nextName(index:int):String

Returns the name of the next property when looping through the collection.

Parameters
index:int

Returns
String
nextNameIndex()method 
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
index:int

Returns
int
nextValue()method 
flash_proxy override function nextValue(index:int):*

Returns the value of the next property when looping through the collection.

Parameters
index:int

Returns
*
removeEventListener()method 
public function removeEventListener(type:String, listener:Function, useCapture:Boolean = false):voidParameters
type:String
 
listener:Function
 
useCapture:Boolean (default = false)
removeListener()method 
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)
setProperty()method 
flash_proxy override function setProperty(name:*, value:*):void

Sets a property.

Parameters
name:*
 
value:*
willTrigger()method 
public function willTrigger(type:String):BooleanParameters
type:String

Returns
Boolean