el preload q aparece en el codigo que voy a poner sta colocado en el escenario. Lo que carga cada campo con su txt e imagen es un MC almacenado en la biblioteca q se duplica con su contenido correspondiente q esta en el XML.
Aqui os dejo el codigo, espero q podais echarme una mano:
Código ActionScript :
var myMenu:XML = new XML();
myMenu.ignoreWhite = true;
System.useCodepage = true;
myMenu.load("enlaces.xml");
linkBoton = new Array();
textoBoton = new Array();
precioBoton = new Array();
imageBoton = new Array();
myMenu.onLoad = function() {
for (var i = 0; i<this.firstChild.childNodes.length; i++) {
textoBoton[i] = this.firstChild.childNodes[i].attributes.name;
precioBoton[i] = this.firstChild.childNodes[i].attributes.precio;
linkBoton[i] = this.firstChild.childNodes[i].attributes.link;
imageBoton[i] = this.firstChild.childNodes[i].attributes.image;
}
creaBtns(this.firstChild.childNodes.length);
};
function creaBtns(cuantosBotones) {
var filas = 4;
var columnas = 2;
var xOffset = 295 //10 de separaciónX
var yOffset = 130 //10 de separaciónY
var depth = 0;
count = 0;
for (var f = 0; f<filas; f++) {
for (var c = 0; c<columnas; c++) {
target = this.attachMovie("boton", "boton"+depth, depth++, {_x: c*xOffset, _y: f*yOffset});
target.image_mc.loadMovie(imageBoton[depth-1]);
target.link = linkBoton[depth-1];
target.mytexto.text = textoBoton[depth-1];
target.precio.text = precioBoton[depth-1];
target.onRelease = function() {
getURL("javascript:muestraImagen('linkBoton[depth-1]', 'Descripción Foto #1');");
};
if(++count>=cuantosBotones) return;
}
}
}
this.onEnterFrame = function() {
filesize = target.image_mc.getBytesTotal();
loaded = target.image_mc.getBytesLoaded();
target.preloader._visible = true;
if (loaded != filesize) {
target.preloader.preload_bar._xscale = 100*loaded/filesize;
} else {
target.preloader._visible = false;
if (target.image_mc._alpha<100) {
target.image_mc._alpha += 10;
}
}
};
Muchas gracias!!
