PDA

View Full Version : dynamic naming of variable


Thitinan
10-18-2005, 05:13 AM
Hi,

for(i=1;i<21;i++){
_root["point"+i]_x = 15*i;
}

Will the above code give me _root.point1_x = 15, _root.point2_x = 30 and so on?

Is it possible to do such a thing with flash? There is already an object called point1, point2, and so on.

Thanks

oldnewbie
10-18-2005, 05:19 AM
It should, but the correct syntax would be...

_root["point"+i]._x = 15*i;

Thitinan
10-18-2005, 05:20 AM
thank you :)