Referencing movie clips

Hi,

I’m doing a simple duplicate movie like this:

[COLOR=blue]duplicateMovieClip(_root.snake, “_root.snakecopy”+i,i);[/COLOR](i does increment)

and trying to reference the <i>_x</i> value of each new movieClip made like this:

[COLOR=blue]snakeCopy = “_root.snakecopy”+i;
trace(snakeCopy._x);[/COLOR]

But as I am finding, I can’t reference the new movieClips like that. So, my question is:

<b>How can I reference a movieClip in an array</b>:q:

This’ll do it.

snakeCopy = root[“snakecopy”+i];
trace(snakeCopy._x);

Also, I’m not sure, but your first line may not be working. You may need to replace it with:

duplicateMovieClip(_root.snake, “snakecopy”+i,i);

Cheers.

-Al

I kept my first part the same, and took out the [COLOR=blue]_root[/COLOR] in the duplicate movie statement, and it worked like a charm.

=)
Thanks

alternatively you can also use

eval("_root.snakecopy"+i)

and if using duplicateMovieClip in the form of
MovieClip.duplicateMovieClip(newName, depth)
you can also use

thisClip = _root.snake.duplicateMovieClip(“snakecopy”+i, i);
thisClip._x …