Variable Names with Dynamic MC's

Hey Kirupans!

I’m making a game where I create a number of empty movie clips, and attach terrain objects from the library. That part is working fine, and I use code similar to below:


_root.createEmptyMovieClip("T" + _root.i, _root.i);
_root.attachMovie("MC_Floor_1", "T" + _root.i, _root.i);

Now though, how do I reference these objects later on? For instance, I want to set the starting x and y values of this clip I just made. I tried this:


_root."T" + _root.i._x = 100;

Flash didn’t like that syntax. Any suggestions on how I can dynamically create clips, and then still be able to reference one based on its “i” value?

Thanks for the help!

The Ital Stal :mario:

_root.createEmptyMovieClip("T"+_root.i, _root.i);
_root.attachMovie("MC_Floor_1", "T"+_root.i, _root.i);
_root["T"+_root.i]._x = 100;
_root["T"+_root.i]._y = 200;
//or
_root.createEmptyMovieClip("T"+_root.i, _root.i);
mc = _root.attachMovie("MC_Floor_1", "T"+_root.i, _root.i);
mc._x = 100;
mc._y = 200;

Claudio,

I love you. You are my hero.
(Sorry if thats a bit over the top, but you just made my day!)

=)