stop(); //Generate the Main Menu function generateMenu() { // first level o childs of the root node will go into an array var a:Array = _global.gRoot.childNodes; for (var i in a) { //for each node of that array we attach a symbol with the id "mainMenuItem" var mc = this.attachMovie("mainMenuItem", "mmi"+i, this.getNextHighestDepth()); // set hise data by asigning the coresponding XMLNode mc.Node = a[i];//asign a XMLNode // set his position with the help of miHeight preoperty wich returns de menu item's height mc._y = 60+mc.miHeight*i; mc._x = 8; } } // call de above function generateMenu();