//Creamos una nueva instancia XML menuXml = new XML(); //Ignoramos los espacios en blanco menuXml.ignoreWhite = true; //Creamos una función asegurarnos de que se ha cargado menuXml.onLoad = function(success) { if (success) { //Creamos una variable "menuItem" que nos devuelve // una array con todos los items del menu var menuItem = menuXml.firstChild.childNodes; //Creamos un bucle desde 0 al total de items (menuItem.length) for (var i = 0; i Nombre = this.firstChild.childNodes[i].attributes.name; //Accedemos al atributo url de cada uno de los items Link = menuItem[i].attributes.url; //Mediante attachMovie creamos instancias del clip de pelicula item_mc attachMovie("item_mc", "item_mc"+i, i); //A cada una de las instancias le asignamos... //La posición en la coordenada x _root["item_mc"+i]._x = 40; //La posición en la coordenada y _root["item_mc"+i]._y = 20*i; //La etiqueta de texto _root["item_mc"+i].etiqueta_txt.text = Nombre; //El link al que irá _root["item_mc"+i].Link = Link; _root["item_mc"+i].Rectangulo_btn.onRollOver = function () { mc_bnt1.onEnterFrame = function () { if (this._currentframe != 10) { this.nextFrame(); } else { this.stop(); delete this["onEnterFrame"]; } // end if }; pincel1.onEnterFrame = function () { if (this._currentframe != 10) { this.nextFrame(); } else { this.stop(); delete this["onEnterFrame"]; } // end if }; } _root["item_mc"+i].Rectangulo_btn.onRollOut = function () { mc_bnt1.onEnterFrame = function () { if (this._currentframe != 1) { this.prevFrame(); } else { this.stop(); delete this["onEnterFrame"]; } // end if }; pincel1.onEnterFrame = function () { if (this._currentframe != 1) { this.prevFrame(); } else { this.stop(); delete this["onEnterFrame"]; } // end if }; } //Le asignamos la acción al boton _root["item_mc"+i].Rectangulo_btn.onRelease=function(){ loadMovie(this._parent.Link, contenedor_mc); } //Cerramos el bucle } //Cerrramos el if } //Cerramos la funcion }; menuXml.load("flash_menu.xml");