UPDATE: This class is now available on github: https://github.com/moagrius/Dictionary. Further updates will be affected there.

AS3 has a handy object called a Dictionary (this construct exists in other languages, but with variance in implementation and definition). A Dictionary is effectively an object that allows keys to be assigned using identity, whereas a traditional Object object only supports string keys. See my post here on using Dictionary objects in AS3.

So if you were to assign an Object object a key of an element, it’d likely be overwritten as the element would be natively converted into a string – often an [Object object] or [HTMLObject]. This is not the case with a Dictionary in those languages where it is supported – key:value pairs of objects (including display elements) can be assigned and will be supported.

JavaScript lacks this feature nativey, but here’s an emulation.