Packageorg.springextensions.actionscript.collections
SVN browsingProperties.as
FisheyeProperties.as
Classpublic class Properties
InheritanceProperties Inheritance flash.events.EventDispatcher

The Properties class represents a collection of properties in the form of key-value pairs. All keys and values are of type String

Author: Christophe Herreman
Version: $Revision: 21 $, $Date: 2008-11-01 22:58:42 +0100 (za, 01 nov 2008) $, $Author: dmurat $
Since: 0.1



Public Properties
 PropertyDefined by
  content : Object
[read-only] The content of the Properties instance as an object.
Properties
  length : uint
[read-only]
Properties
  propertyNames : Array
[read-only] Returns an array with the keys of all properties.
Properties
Public Methods
 MethodDefined by
  
Creates a new Properties object.
Properties
  
formatURL(url:String, preventCache:Boolean):String
Adds a random number to the url, checks if a '?' character is already part of the string than suffixes a '&' character
Properties
  
getProperty(key:String):String
Gets the value of property that corresponds to the given key.
Properties
  
load(url:String, loader:URLLoader = null, preventCache:Boolean = true):void
Loads a collection of properties from an external file.
Properties
  
merge(properties:Properties, overrideProperty:Boolean = false):void
Adds all content of the given properties object to this Properties.
Properties
  
setProperty(key:String, value:String):void
Sets a property.
Properties
Protected Methods
 MethodDefined by
  
If the _loader variable is not null the onLoaderComplete and onIOError event handlers are removed and the variable is set to null;
Properties
  
IOError_handler(event:IOErrorEvent):void
Redispatches the IOErrorEvent event.
Properties
  
LoaderComplete_handler(event:Event):void
Parses the received properties file and dispatches an Event.COMPLETE event.
Properties
Events
 EventSummaryDefined by
   Dispatched when the external properties file has been loaded and the contents have been parsed.Properties
   Dispatched when an error occured while loading the external property file.Properties
Property detail
contentproperty
content:Object  [read-only]

The content of the Properties instance as an object.

Implementation
    public function get content():Object
lengthproperty 
length:uint  [read-only]Implementation
    public function get length():uint
propertyNamesproperty 
propertyNames:Array  [read-only]

Returns an array with the keys of all properties. If no properties were found, an empty array is returned.

Implementation
    public function get propertyNames():Array
Constructor detail
Properties()constructor
public function Properties()

Creates a new Properties object.

Method detail
cleanupLoader()method
protected function cleanupLoader():void

If the _loader variable is not null the onLoaderComplete and onIOError event handlers are removed and the variable is set to null;

formatURL()method 
public function formatURL(url:String, preventCache:Boolean):String

Adds a random number to the url, checks if a '?' character is already part of the string than suffixes a '&' character

Parameters
url:String — The url that will be processed
 
preventCache:Boolean

Returns
String — The formatted URL
getProperty()method 
public function getProperty(key:String):String

Gets the value of property that corresponds to the given key. If no property was found, null is returned.

Parameters
key:String — the name of the property to get

Returns
String
IOError_handler()method 
protected function IOError_handler(event:IOErrorEvent):void

Redispatches the IOErrorEvent event.

Parameters
event:IOErrorEvent — the IOErrorEvent instance received from the internal URLLoader.
load()method 
public function load(url:String, loader:URLLoader = null, preventCache:Boolean = true):void

Loads a collection of properties from an external file. Each property must be on a new line and in the form key= value. All keys and values are trimmed. Blank lines that do not contain properties are ignored. When the loading (and parsing) is done, a Event.COMPLETE event is dispatched.

Parameters
url:String — the url of the properties file
 
loader:URLLoader (default = null) — optional URLLoader instance to be used for the actual loading of the property file
 
preventCache:Boolean (default = true) — If true a random string is added to the specified URL to prevent the browser from caching the file
LoaderComplete_handler()method 
protected function LoaderComplete_handler(event:Event):void

Parses the received properties file and dispatches an Event.COMPLETE event.

Parameters
event:Event

See also

merge()method 
public function merge(properties:Properties, overrideProperty:Boolean = false):void

Adds all content of the given properties object to this Properties.

Parameters
properties:Properties
 
overrideProperty:Boolean (default = false)
setProperty()method 
public function setProperty(key:String, value:String):void

Sets a property. If the property with the given key already exists, it will be replaced by the new value.

Parameters
key:String — the key of the property to set
 
value:String — the value of the property to set
Event detail
completeevent 
Event object type: flash.events.Event

Dispatched when the external properties file has been loaded and the contents have been parsed.

ioErrorevent  
Event object type: flash.events.IOErrorEvent

Dispatched when an error occured while loading the external property file.