Copy link to clipboard
Copied
This code causes a runtime Error#1037 when publishing in AS3, but not in AS2.
var myArray:Array=[];
myArray["every"]=[];
I'm guessing that is because every is an already defined method in the Array class.
Should I be using the dictionary class instead? Any good tips on that? Anything I should really know?
i'm not sure what you're trying to do but the Array class is used for ordered lists. You should NOT be using a string for a key.
if you want to create an unordered list = hash=map in flash (and use strings for keys), use an object:
var obj:Object={}
obj["every"]=[]; // if you want the value to be an array or
obj["ever"]={}; // if you want the value to be another object/has/map
use a dictionary if you want to use objects for keys.
Copy link to clipboard
Copied
i'm not sure what you're trying to do but the Array class is used for ordered lists. You should NOT be using a string for a key.
if you want to create an unordered list = hash=map in flash (and use strings for keys), use an object:
var obj:Object={}
obj["every"]=[]; // if you want the value to be an array or
obj["ever"]={}; // if you want the value to be another object/has/map
use a dictionary if you want to use objects for keys.
Copy link to clipboard
Copied
I guess bad old got away with it in AS2 habits die hard. Thanks.