Arg...Frusterated(Dynamicly created MC's)

OK so I have a Whole tree (you know where birds like to build nests)

and I have this tree broken into 2 parts the Bottom(wich is gonna hitTest against the character) and the top(which is just a gfx that the player can walk right through(or under))

In the Clips Actions for the Bottom Part I have this

onClipEvent (load) {
 function reset(){
 this._x=random(550);
 this._y=random(200)+100;
 enemySpeed=random(4)+1;
 }
 reset();
}

That randomly Generates a a tree Bottom somewhere on screen as soon as a clip is created(and names them treeBottom1

then in the Actions for the TreeTop I have

onClipEvent (load) {
    stringtoparse = String(this)
     parsedstring = stringtoparse.split("treeTop")
    thisindex = Number(parsedstring[1]);
    
 this._x=_root["treeBottom"+thisindex]._x-42;
 this._y=_root["treeBottom"+thisindex]._y-85;
 trace("ThisIndex = "+thisindex+"   X = "+this._x+"   Y = "+this._y)
 
}

this gets the instance of the treetop being created and tells it to position its self on top of the tree bottom(that matches the instance)

In my control Layer I have this code to generate the trees

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

It Places The tree that is already on the stage(Instance :TreeTop1,TreeBottom1)Randomly perfectly but the second tree it cuts off the bottom corner and all the other 9 trees end up directly on top of the 2nd tree so instead of 10 trees it looks like there are 2 trees

WTF am i doing wrong…please help :slight_smile:

bump(and a bit more info)

If i dont do the constructor section on the Treetop it will randomly generate all 10 bottoms and …so i have a feeling it has to do with the treetop

this sounds like a job or actionscript 2.0 :O, oop im not sure exactly how you have this setup so maybe you could post a .fla and i will fix it for and explain in details since you have a clue what your doing i will help you if your like your choice

I owuld really like that ill attach the FLA as soon as i get home…its not much atm im just trying to mess around and learn AS by trial and error

edit. hmmm.its too big to attach…can i email it to you or somethign?

Bah i figured it out…the depth on the duplicate was the same in both top and bottom…didnt realize depths had to be unique