| Package | org.springextensions.actionscript.collections |
| SVN browsing | Properties.as |
| Fisheye | Properties.as |
| Class | public class Properties |
| Inheritance | Properties flash.events.EventDispatcher |
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
| Property | Defined 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 | ||
| Method | Defined 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 | ||
| Method | Defined by | ||
|---|---|---|---|
|
cleanupLoader():void
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 | ||
| Event | Summary | Defined 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 | |||
| content | property |
content:Object [read-only]The content of the Properties instance as an object.
Implementation public function get content():Object
| length | property |
length:uint [read-only]Implementation
public function get length():uint
| propertyNames | property |
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
| Properties | () | constructor |
public function Properties()
Creates a new Properties object.
| 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):StringAdds a random number to the url, checks if a '?' character is already part of the string than suffixes a '&' character
Parametersurl:String — The url that will be processed
|
|
preventCache:Boolean |
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.
key:String — the name of the property to get
|
String |
| IOError_handler | () | method |
protected function IOError_handler(event:IOErrorEvent):void
Redispatches the IOErrorEvent event.
event:IOErrorEvent — the IOErrorEvent instance received from the internal URLLoader.
|
| load | () | method |
public function load(url:String, loader:URLLoader = null, preventCache:Boolean = true):voidLoads 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.
Parametersurl: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.
event:Event |
See also
| merge | () | method |
public function merge(properties:Properties, overrideProperty:Boolean = false):voidAdds all content of the given properties object to this Properties.
Parametersproperties:Properties |
|
overrideProperty:Boolean (default = false) |
| setProperty | () | method |
public function setProperty(key:String, value:String):voidSets a property. If the property with the given key already exists, it will be replaced by the new value.
Parameterskey:String — the key of the property to set
|
|
value:String — the value of the property to set
|
| complete | event |
flash.events.Event
Dispatched when the external properties file has been loaded and the contents have been parsed.
| ioError | event |
flash.events.IOErrorEvent
Dispatched when an error occured while loading the external property file.