Package | flash.utils |
Class | public dynamic class Dictionary |
Inheritance | Dictionary Object |
Language Version: | ActionScript 3.0 |
Runtime Versions: | AIR 1.0 Flash Player 9 |
===
) for key comparison. When an object is used as a key, the object's
identity is used to look up the object, and not the value returned from calling toString()
on it.
Primitive (built-in) objects, like Numbers, in a Dictionary collection behave in the same manner as they do when
they are the property of a regular object.
The following statements show the relationship between a Dictionary object and a key object:
var dict:Dictionary = new Dictionary(); var obj:Object = 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 because key.toString == "key" dict["key"] == "Letters"; // false because "key" === key is false delete dict[key]; //removes the key
Important:The Dictionary class is only available to ActionScript 3.0 code (running in SWF content). It is not available to JavaScript code (running in Adobe® AIR™).
See also
Public Properties
Public Methods
Method | Defined By | ||
---|---|---|---|
Dictionary(weakKeys:Boolean = false)
Creates a new Dictionary object. | Dictionary | ||
Indicates whether an object has a specified property defined. | Object | ||
Indicates whether an instance of the Object class is in the prototype chain of the object specified
as the parameter. | Object | ||
Indicates whether the specified property exists and is enumerable. | Object | ||
Sets the availability of a dynamic property for loop operations. | Object | ||
Returns the string representation of this object, formatted according to locale-specific conventions. | Object | ||
Returns the string representation of the specified object. | Object | ||
Returns the primitive value of the specified object. | Object |
Constructor Detail
Dictionary | () | Constructor |
public function Dictionary(weakKeys:Boolean = false)
Language Version: | ActionScript 3.0 |
Runtime Versions: | AIR 1.0 Flash Player 9 |
Creates a new Dictionary object. To remove a key from a Dictionary object, use the delete
operator.
weakKeys:Boolean (default = false ) — Instructs the Dictionary object to use "weak" references on object keys.
If the only reference to an object is in the specified Dictionary object, the key is eligible for
garbage collection and is removed from the table when the object is collected.
|
Fri Mar 19 2010, 02:45 AM -07:00