This content has been marked as final. Show 3 replies
Oh, i'm very very sorry for my silly mistake.
After checking my codes again, i found the real reason why i received exception error.I forget to new it before i add property to the map object. So the exception error shows me that i reference a Null Object , not that i reference an undefined property of this object.
Anyway, now i know if i add a property to a dynamic-class object, no error will be threw :)
Sorry for wasting your time again.And i still hope that you could give me an advice to the first question. As i konw, Most Map in other language uses Hash algorithm(or something like that) to improve performance. So i wonder if i could a real map to replace the old trick.
Using an Object as a map is not actually a "trick". The Adobe engineers meant for it to be used this way, that's why there is no map object. I haven't seen any documentation as to how Object implements its lookup (be it a hash or otherwise), but given how heavily this functionality is used, I doubt they would've implemented a naive algorithm. And in the end, if it isn't causing any performance bottlenecks, then it's all good.
Thanks for your advice.
Now that it is recommended, I'd use it more bravely.