Building new Variables

How can i create new variables when i duplicate clips ?
This is my code (symplified):
For(i=o;i<5;i++){
_root.createEmptyMovieClip([“clip”+i], 0);
_root.[“clip”+i]._y = 25*i;
}

the problem is that i wan’t to be able to use Clip1 then Clip2, Clip3, etc… as my variables but i don’t know how i’m supposed to write it.
I there is a problem with the [“Clip”+i].
Does anyone know ?

for(i=0;i<5;i++){
_root.createEmptyMovieClip(“clip”+i, i);
_root[“clip”+i]._y = 25*i;
}

  1. for is case sensitive
  2. dont you mean 0 instead of o?
  3. createEmptyMovieClip takes a string as an argument for the name, no [] needed
  4. use i in the depth argument so they dont replace each other
  5. in using [] for reference its object[stringname].property - no dot between the object and the []

for future referencing of the clips, you can use _root.clip0 -> _root.clip4 or something like _root[“clip”+0] or some variable to replace 0 which is between 0 and 4.

that help?

Thanks alot senocular, i works out perfect thanks to you !

One more thing,
when i load a movie in each newClip, i want to send a variable to that specific movie so the texte changes.
Here’s the script :

for(i=0;i<5;i++){
_root.createEmptyMovieClip(“clip”+i, i);
_root[“clip”+i]._y = 25*i;
loadMovie(“texteDyn.swf”,“clip”+i);
bling = “bye” + i;
}

in the movie texteDyn.swf there’s a text variable called Bling but my command doesnt change this texte. How can i send a variable to that clip ?

_root[“clip”+i].bling = “bye”+i;

and you’ll need to wait until the external .swf is fully loaded into the MovieClip to assign the variable, otherwise the variable will be lost once it’s fully loaded. :wink:

thx alot guys your help is precious !