Dwayne Neckles wrote:

can anyone say why dictionary is better than array.. Im seeing it
used in alot of papervision examples and i dont get why? I will
research this on my own as well..

Keys in an Array can be numeric, strings, or both:

var a:Array = [];
a[0] = something;
a["hello"] = something; // associative Array

Keys in a Dictionary can theoretically be of any type:

var d:Dictionary = new Dictionary();
d[0] = something;
d["hello"] = something;

var c:SomeClass = new SomeClass();
d[c] = something;

An associative Array behaves similar to a Dictionary.

I might be wrong but i remember seeing that if you want to store data with string keys, Dictionary is performing slightly better.

A word of caution if you plan to use E4X XML nodes or function references as Dictionary keys: this appears to be buggy.

Cheers,
Claus.
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to