View Full Version : var dynamic
ricmetal
12-10-2008, 09:16 PM
hey
i cant seem to get this working:
i want to trace "dang!"
AS2
imgNumb = 1;
newi = imgNumb.toString();
_root.myData.image1 = "dang!";
imageName = ["_root.myData.image" + newi];
trace(imageName);
all i get is "_root.myData.image1"
any ideas?
gnomeontherun
12-10-2008, 09:49 PM
imageName = [_root.myData.image + newi];
Well quotes turn that into a string, and not into a reference to an item. Does this work?
ricmetal
12-10-2008, 09:56 PM
it might, i just found out that tracing _root.myData.image1 yields undefined.
*what?*
any idea why this happens?
it's the only script i have on the fla
ricmetal
12-10-2008, 09:58 PM
duh, there no myData
...
ricmetal
12-10-2008, 10:01 PM
imageName = [_root.myData.image + newi];
Well quotes turn that into a string, and not into a reference to an item. Does this work?
no, that doesn't work
ricmetal
12-10-2008, 10:08 PM
got it :)
imgNumb = 1;
newi = imgNumb.toString();
_root.myData.image1 = "dang!";
imageName = eval("_root.myData.image" + newi);
trace(imageName);
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.