I’ve been using Object as a way to have a generic associative array (map/dictionary) since AS3/Flex seems to be very limited in this regard. But I really don’t like it coming from a C++/Java/C# background. Is there a better way, some standard class I’ve not come across… is this even considered good/bad in AS3?
I’ve been using Object as a way to have a generic associative array (map/dictionary)
Share
Yes, Actionscript uses
Objectas a generic associative container and is considered the standard way of doing this.There is also a
Dictionaryclass available,flash.utils.Dictionary.The difference is that
Dictionarycan use any value as a key, including objects, whileObjectuses string keys. For most uses,Objectis preferred as it is faster and covers the majority of use cases.You can see the details on
Objecthere: http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/Object.htmland
Dictionaryhere: http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/utils/Dictionary.htmland the differences between them here: http://livedocs.adobe.com/flex/3/html/help.html?content=10_Lists_of_data_4.html