Attach MC + how to code so it counts up

Hello there. I am trying to build a menu from nul.

The idea is that i have one mc on the stage (design purposes) and when clicked it generates a bunch of copys,
now later i want to attach some extra code to each generated button/mc.

does one have a guideline for this?
so that standard_mc becomes after its been generated get’s for example standard_mc01, 02,03.

I use this simple code to generate them.


//create root button
this.createEmptyMovieClip("canvas_mc", 1);
ref1 = this.attachMovie("button", "ref1" + i, 100 + i);
ref1._level = 100;
ref1.vALUE = "_root";
ref1._x = 10;
ref1._y = ref1._x;
//ref1._level = 100;
trace ("root has been build"+ _level);



buildmenu = function (){
for (i = 0; i < 4; i++) {
    buttons = this.attachMovie("button", "buttons" + i, 90 + i);
    //position each button on stage. 
    gutter = 111;
    place4buttons = i * 101 + gutter;
    buttons._x = buttons.tween("_x", place4buttons, 0.9, customEasing);
    buttons._y = 10;
    buttons.vALUE = "generated";
    buttons.onRelease = function(){
    trace ("klicked button" + buttons.getDepth());
        }
    }
}
ref1.onRelease = function(){
    trace ("build sub");
    buildmenu();
}

this works like a charm only i stumble on these problems.

a) how to i make sure the generated copies are UNDER my main button, i am aware of the levels but it keeps gerenating above the main button(ref1)
b) how do i make sure that i can assign each generated button later with some individual actionscript.and change some text values easy.

i found out all this by myself, but I feel stuck right now, code is stilla bit sloppy due to experimenting :wink:
Thanks bigtime if someone can assist me.