A quick array question in AS3

5 posts

Flag Post

Is it possible to use char or string indexes in arrays in as3? In the way that instead of:

array[0] = a;
array[1] = b;

I could use:

array['a'] = a;
array["str"] = b;
 
Flag Post

use Object type or Dictionary type for this.

 
Flag Post
Originally posted by vesperbot:

use Object type or Dictionary type for this.

But also, it is perfectly possible with Arrays in AS3 as well, yes.

 
Flag Post

You can attach dynamic properties to any object like that. But if that’s what you’re trying to do, either use Object (i.e. var x:Object = {}), or if the properties are always going to be the same, write a class to encapsulate them.

 
Flag Post

Thank you for replies. I thought there had to be more efficient way rather than searching through all array/sorting the array.