Packagecom.threerings.util
Classpublic class Config
InheritanceConfig Inheritance flash.events.EventDispatcher



Protected Properties
 PropertyDefined by
  _data : Object
The object in which we store things, usually _so.data.
Config
  _so : SharedObject
The shared object that contains our preferences.
Config
Public Methods
 MethodDefined by
  
Config(path:String)
Constructs a new config object which will obtain configuration information from the specified path.
Config
  
ensureCapacity(kilobytes:int, onFailure:Function, onSuccess:Function = null):void
Ensure that we can store preferences up to the specified size.
Config
  
Gets all the property names.
Config
  
getValue(name:String, defValue:Object):Object
Fetches and returns the value for the specified configuration property.
Config
  
isPersisting():Boolean
Are we persisting settings?
Config
  
remove(name:String):void
Remove any set value for the specified preference.
Config
  
setPath(path:String):void
Set the path, if null then we aren't persisting settings.
Config
  
setValue(name:String, value:Object, flush:Boolean = true):void
Returns the value specified.
Config
Events
 EventSummaryDefined by
   Dispatched when this Config object has a value set on it.Config
Public Constants
 ConstantDefined by
  CONFIG_VALUE_SET : String = "ConfigValSet"
[static] The event type dispatched when a config value changes.
Config
Property detail
_dataproperty
protected var _data:Object

The object in which we store things, usually _so.data.

_soproperty 
protected var _so:SharedObject

The shared object that contains our preferences.

Constructor detail
Config()constructor
public function Config(path:String)

Constructs a new config object which will obtain configuration information from the specified path.

Parameters
path:String
Method detail
ensureCapacity()method
public function ensureCapacity(kilobytes:int, onFailure:Function, onSuccess:Function = null):void

Ensure that we can store preferences up to the specified size. Note that calling this method may pop up a dialog to the user, asking them if it's ok to increase the capacity. The result listener may never be called if the user doesn't answer the pop-up.

Parameters
kilobytes:int — a function that will be passed an exception on failure.
 
onFailure:Function — an optional function that will be passed this on success.
 
onSuccess:Function (default = null)
getPropertyNames()method 
public function getPropertyNames():Array

Gets all the property names.

Returns
Array
getValue()method 
public function getValue(name:String, defValue:Object):Object

Fetches and returns the value for the specified configuration property.

Parameters
name:String
 
defValue:Object

Returns
Object
isPersisting()method 
public function isPersisting():Boolean

Are we persisting settings?

Returns
Boolean
remove()method 
public function remove(name:String):void

Remove any set value for the specified preference. This does not dispatch an event because this would only be done to remove an obsolete preference.

Parameters
name:String
setPath()method 
public function setPath(path:String):void

Set the path, if null then we aren't persisting settings.

Parameters
path:String
setValue()method 
public function setValue(name:String, value:Object, flush:Boolean = true):void

Returns the value specified.

Parameters
name:String
 
value:Object
 
flush:Boolean (default = true)
Event detail
ConfigValSetevent 
Event object type: com.threerings.util.NamedValueEvent
NamedValueEvent.type property = com.threerings.util.Config.CONFIG_VALUE_SET

Dispatched when this Config object has a value set on it.

The event type dispatched when a config value changes.

Constant detail
CONFIG_VALUE_SETconstant
public static const CONFIG_VALUE_SET:String = "ConfigValSet"

The event type dispatched when a config value changes.