Help with MocieClips Inside Movie Clips(and Duplicating)

So I have 2 MovieClips named TreeTop(instance = “treeTop1”) and TreeBottom(instance = “treeBottom1”)

The action script for theyre load assembles them into looking like a single tree

So anyway Im trying to run this code in one of my frames


numTrees=10;
        for (i=2; i<=numTrees; i++){
            treeBottom1.duplicateMovieClip( "treeBottom"+i, i+100 );
            treeTop1.duplicateMovieClip( "treeTop"+i, i+50 );
            trace(i)
        }

and if i have them normally in the movie it works fine and places randomly generated trees all over the screen

However i need to encapsulate them in a MovieClip so I can Manipulate all the trees together as a single object
and as soon as i put them into the movie clip they will run theyre own constructors(makes sense) but the duplicatemovieclip code doesnt duplicate them

the movie clip Ive encompassed them in is instance named “TOP_LAYER”

Im guessing im just missing something fairly easy …but how can i get the trees to duplicate in the MC?

[edit] I tried changing
treeBottom1.duplicateMovieClip( “treeBottom”+i, i+100 );
treeTop1.duplicateMovieClip( “treeTop”+i, i+50 );
to
_root.[“TOP_LAYER”].treeBottom1.duplicateMovieClip( “treeBottom”+i, i+100 );
_root[“Top_Layer”].treeTop1.duplicateMovieClip( “treeTop”+i, i+50 );

unfortunatly that didnt work… :frowning:

the easiest way to go about this is to give them a linkage id, and the to use the _root.attachMovie(), and you could just say


var top_layer=_root.createEmptyMovieClip("tl",_root.getNextHighestDepth())
top_layer.attachMovie(/*code in here*/)

thanks man :slight_smile: