Packagede.mightypirates.utils.interfaces
Interfacepublic interface ISettings
ImplementorsSettings

Interface for the Settings class.



Public Properties
 PropertyDefined by
  useSharedObject : Boolean
Whether to use of the shared object for this instance.
ISettings
Public Methods
 MethodDefined by
  
getSetting(name:String):*
Get the current value of a setting.
ISettings
  
getSoSetting(name:String, def:* = null):*
Retrieve a value from the SharedObject associated to these settings.
ISettings
  
isRegistered(name:String):Boolean
Checks if a setting with the given name is registered.
ISettings
  
register(name:String, defaultValue:uint = null, validator:* = null, priority:* = 20):void
Register a setting.
ISettings
  
registerAlias(name:String, setting:String):void
Registers an alias for a setting, allowing access to the setting through the alias name.
ISettings
  
setSetting(name:String, value:*):void
Change the value of a setting.
ISettings
  
setSoSetting(name:String, value:*):void
Store a value in the SharedObject associated to these settings.
ISettings
Property detail
useSharedObjectproperty
useSharedObject:Boolean  [read-write]

Whether to use of the shared object for this instance.

Implementation
    public function get useSharedObject():Boolean
    public function set useSharedObject(value:Boolean):void
Method detail
getSetting()method
public function getSetting(name:String):*

Get the current value of a setting.

Parameters
name:String — the name of the setting.

Returns
*

Throws
— exception if the setting is not registered.
getSoSetting()method 
public function getSoSetting(name:String, def:* = null):*

Retrieve a value from the SharedObject associated to these settings.

Parameters
name:String — the name of the setting.
 
def:* (default = null) — a default value to return if the setting is not set in the shared object.

Returns
*
isRegistered()method 
public function isRegistered(name:String):Boolean

Checks if a setting with the given name is registered.

Parameters
name:String — the setting to check for existance.

Returns
Boolean — true if the setting is registered, else false.
register()method 
public function register(name:String, defaultValue:uint = null, validator:* = null, priority:* = 20):void

Register a setting. Will be initialized to the default value.

It is assumed that the default value is valid [1], but the value is sent through the validator once, nonetheless, to allow it to perform any other actions it would when getting a new setting (to avoid having to write additional initializations).

[1] valid in the sense of not being null, undefined or of an invalid type. If the default value does not fit into the bounds enforced by the validator it will be adjusted accordingly.

Parameters
name:String — the name of the setting to register.
 
defaultValue:uint (default = null) — the default value for that setting.
 
validator:* (default = null) — the validator to use for that setting. If not given, it is tried to find a default validator for the defaultValue. This is possible for "boolean", "number" and "string". Because "int" and "uint" get evaluated as "number", it is possible to use those types as a shortcut by passing them as the validator parameter, i.e. you could e.g. use:
settings.register("some.setting", 4, uint);

instead of the long
settings.register("some.setting", 4, Validation.validateUInt);
 
priority:* (default = 20) — the value's priority when parsing settings from xml definitions. Settings with lower numbers get parsed first.
registerAlias()method 
public function registerAlias(name:String, setting:String):void

Registers an alias for a setting, allowing access to the setting through the alias name.

Parameters
name:String — the name of the alias to register.
 
setting:String — the name of the actual setting the alias should forward to.
setSetting()method 
public function setSetting(name:String, value:*):void

Change the value of a setting. If a validator is set for that setting it will be used to check the new value before setting it.

Parameters
name:String — the name of the setting to change.
 
value:* — the new value for the setting.

Throws
— exception if the setting is not registered.
setSoSetting()method 
public function setSoSetting(name:String, value:*):void

Store a value in the SharedObject associated to these settings.

Parameters
name:String — the name of the setting to store.
 
value:* — the value for the setting.