Packageflash.utils
Classpublic dynamic class Dictionary
InheritanceDictionary Inheritance Object

The Dictionary class allows you to create a dynamic collection of properties, which uses strict equality (===) for key comparison. When an object is used as a key the object's identity is used to lookup the object and not the value returned from calling toString() on it.

So:

 var dict = new Dictionary();
 var obj = new Object();
 var key:Object = new Object();
 key.toString = function() { return "key" }
  
 dict[key] = "Letters";
 obj["key"] = "Letters";
  
 dict[key] == "Letters" // true
 obj["key"] == "Letters" // true 
 obj[key] == "Letters" // true because key == "key" is true b/c key.toString == "key"
 dict["key"] == "Letters" // false because "key" === key is false
 

See also
=== (strict equality)


Public Properties
Hide Inherited Public Properties
Show Inherited Public Properties
 PropertyDefined by
 Inheritedconstructor : Object
A reference to the class object or constructor function for a given object instance.
Object
 Inheritedprototype : Object
[static] A reference to the prototype object of a class or function object.
Object
Public Methods
Hide Inherited Public Methods
Show Inherited Public Methods
 FunctionDefined by
  
Dictionary(weakKeys:Boolean = false)
Creates a new Dictionary object.
Dictionary
 Inherited
Indicates whether an object has a specified property defined.
Object
 Inherited
Indicates whether an instance of the Object class is in the prototype chain of the object specified as the parameter.
Object
 Inherited
Indicates whether the specified property exists and is enumerable.
Object
 Inherited
Sets the availability of a dynamic property for loop operations.
Object
 Inherited
Returns the string representation of the specified object.
Object
 Inherited
Returns the primitive value of the specified object.
Object
Constructor detail
Dictionary constructor

public function Dictionary(weakKeys:Boolean = false)

Creates a new Dictionary object.

Parameters
weakKeys:Boolean (default = false) — Instructs the Dictionary instance to use "weak" references on object keys. If the only reference to an object is in the specified Dictionary, the key will be eligible for garbage collection and will be removed from the table when the object is collected.




 

Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/labs/flashauthoringpreview/flash/utils/Dictionary.html