just trying to have mx create some buttons for me. but i’m brain dead or something today because my code’s not working and i can’t see why. on the stage, i have a movieclip whose instance name is “myMc”:
//how many buttons
var totalbuttons = 5;
//space buttons
var baseX = 10;
var baseY = 10;
var spacer = myMc._height;
//loop to create buttons
for (var y = 1; y <= totalbuttons; y++) {
myMc = duplicateMovieClip(“button” add y, eval(“button” add y), 2000 + y);
eval(“button” add y)._x = baseX;
eval(“button” add y)._y = baseY + (y - 1 * spacer);
}
shouldn’t this give me 5 buttons, nicely spaced, named button 1 thru 5? what am i missing here?
yeah, i gotta learn the new mx coding style - in flash 5 you could basically code like flash 4, but in mx this isn’t going to work anymore!
so now i have real mx code for my movie clip that will serve as a button:
//how many buttons
totalButtons = 5;
//space buttons
baseX = 0;
baseY = 0;
spacer = myMc._height + 10;
//loop to create buttons
for (y = 1; y <= totalButtons; y++) {
duplicateMovieClip (“myMc”, “button” + y, 2000 + y);
this[“button” + y]._x = baseX;
this[“button” + y]._y = baseY + ((y - 1) * spacer);
}
//clear sample clip from stage
myMc.unloadMovie();
this works. now i want to dynamically load the labels too. my movie clip has a text field, instance name “text.” i guess i want to actually want to make the variable name dynamic as well so i can set the labels in the code. something like: