Hi gee,
not really a database issue (probably would have been better posted elsewhere in the forums) but here goes.
I have created some code for you to dissect :
//:::: Create an array to populate menu - normally gained from a DB call
menu_items = [
"one",
"two",
"three"
];
function prepMenu(){
//calculate how many menu item to create
var arrayLen = menu_items.length;
// loop through the array to create menu items
for(var i=0; i<arrayLen; i++){
createMenuItem(i)
}
}
function createMenuItem(index){
// Create a menuitem (empty clip)
this.createEmptyMovieClip("menuItem"+index, index);
this["menuItem"+index]._x = 50;
this["menuItem"+index]._y = 20*index;
// give the clip a label
this["menuItem"+index].createTextField("label_txt", 0, 0, 0, 100, 100);
this["menuItem"+index].label_txt.text = menu_items[index];
// some action when clicked on
this["menuItem"+index].onRelease = function(){
trace(menu_items[index]);
}
// change colour when rolled over
this["menuItem"+index].onRollover = function(){
this.label_txt.textColor = 0x0000ff;
}
// change colour back when rolled out
this["menuItem"+index].onRollout = function(){
this.label_txt.textColor = 0x000000;
}
}
prepMenu();
See how you go with this.
Regards,
Matt