jeudi 14 mai 2015

Adding a new child movieclip

I am trying to get a cube movieclip to create another instance of itself and then add it to the stage at the coordinates right next to the previous one. However I can't get it to keep adding more children/ can't figure out how to access the childs coords. I attempted to add a new movieclip:mc every iteration of the for loop with the vertical and horizontal counting back by 50 every time and then,on a different thought process, i tried adding a new child every loop but I don't know how to access that childs properties. Any help would be appreciated. Thank you.

var countV:int=600;
var countH:int=600;
stage.addChild(havenAlpha);
var moveHOrV:Boolean=true;
var mc:MovieClip = new haven_Expand();
for(var i:int=0; i<=5; i++){

            if(moveHOrV == false){
                stage.addChild(mc);
                countH=countH-50;
                mc.x= countH;
                moveHOrV=true;

            }else if(moveHOrV == true){
                stage.addChild(mc);
                countV=countV-50;
                mc.y=countV;
                moveHOrV=false;
            }

            trace(countV,countH,moveHOrV,i);

            stage.addChild(new haven_Expand())
            stage.addChildAt(new haven_Expand(),countH);


        }

Aucun commentaire:

Enregistrer un commentaire