This type of thing (from your code):
var i = i;
switch (i) {
case 0 :
bsntext = "Ag Management Solutions";
break;
case 1 :
bsntext = "Cotton Harvesting";
break;
default :
bsntext = "testing 1 2 3";
}
Is a good example of something that can be done more simply using an array. For example:
code:
buttonText = ["Ag Management Solutions","Cotton Harvesting","etc..."];
bsntext = buttonText[i];
The next problem is how do you assign the text to each button? If each button contains a text field called "label_txt" you could do something like:
mc.label_txt.text = buttonText[i];
While you're setting up all the other stuff in the grid-making loop. If your button doesn't already have a text field, add one, and make sure you know what it's name is (give it a name, if you haven't).




Reply With Quote