This guy implemented HashMap among other things. Looks like you just have to cut and paste the listings to get it.
http://www.ericfeminella.com/blog/actionscript-3-apis/
The real problem is, you should be able to iterate over an associative array and get it’s values using array syntax. I don’t want to call HashMap.put(key, object) and HashMap.get(key) every time. I want to create an object declaratively like
var foo:Object = {myKey:myObject, anotherkey:anotherObject};
I then want to pass the keys to a dataProvider with foo.getKeys() or retrieve data with foo[‘mykey’].
I tried creating tacking a function onto the prototype
Object.prototype.getKeys = function(){ var keys:ArrayCollection = new ArrayCollection(); for each (key in this) { keys.addItem(key); } return keys; }
But that didn’t seem to work. (obviously we don’t want to add getKeys() to Object, so I’d create a class that extends Object, only I can’t find out an easy way to pass the literal instantiation
{myKey:myObject, anotherkey:anotherObject};
to the base Object.
Here’s another rant about actionscript and collections:
http://blog.iconara.net/2007/11/25/architectural-atrocities-part-8-is-there-no-equality/