Thursday, February 23, 2012

Object type can work like dictionary as3

//Did not know this could be done:
var mc:MovieClip = new MovieClip();
mc["x"] = 0; //works like mc.x
mc["y"] = 0; //works like mc.y

//Also, while trying to make a function to put objects in a "global dictionary",
//I realized that... I need an "Object" instance... not a "Dictionary" instance.
var obj:Object = new Object();
obj["kay"] = "123"; //store value
obj["pika"] = mc; //store object

No comments:

Post a Comment