Building Dynamic Menu

Hi guys, I have managed to get data out from Mysql database.

All it returns to me are:

  1. Name of the button
  2. Where it link to
  3. Number of Buttons for the menu

So now, how can I build a menu of buttons such that I can display according to the database return on the number of buttons?

Can someone point me to the exactly codes on how I should do it?

I have already create a movieclip which is the image of a single button. With dynamic text on top of the button in the movieclip.

I just need to loop it thru the number of buttons and display the buttons on screen. But i can’t seems to get it right.

I have looked through the XML dynamic menu but it’s not very similar to mine as I’m using PHP script to connect to the database.

//Nb = Name of the button
//mc.Nb = new mc w/ Nb in it.
//li = Where it link to
//nM = Number of Buttons for the menu
var nM:Number = 5;
var li:String = “http://www.cnn.com”;
for (var x = 0; x<nM; x++) {
mc.duplicateMovieClip(“mc”+x, this.getNextHighestDepth(), {_x:mc._x, _y:mc._y+20*x});
_root[“mc”+x].onRelease = function() {
getURL(li, “_blank”);
};
}

an fla

Heres my .fla file. Doesn’t seems to work for me.