for (var k in dictionary)
{
var key:KeyType = KeyType(k);
var value:ValType = ValType(dictionary[k]); // <-- lookup
// do stuff
}
This is what I use to loop through the entries in a dictionary. As you can see in every iteration I perform a lookup in the dictionary. Is there a more efficient way of iterating the dictionary (while keeping access to the key)?
Iterate through keys & values:
Iterate through values more concisely:
In AS3 there are 3 different
for
loops, you should use one that suits your needs best.