Ver Mensaje Individual
  #1 (permalink)  
Antiguo 13/07/2010, 09:56
Avatar de NaRanJiTo78
NaRanJiTo78
 
Fecha de Ingreso: noviembre-2007
Ubicación: In the BeaCh
Mensajes: 874
Antigüedad: 17 años, 1 mes
Puntos: 10
Pregunta Boton extra que lea otro xml

Hola!

Tengo el siguiente código:
Cita:
var xmlFile:String = "fichero1.xml";

var xml:XML = new XML(xmlFile);

var idAtual:Number = new Number();

var total:Number = new Number();

maskMc._width = stageWidth;

maskMc._height = stageHeight;

this.setMask(maskMc);

//
lstThumb.onLoadInit = function(mc:MovieClip) {
mc._parent.pre._visible = false;
var aimg:Tween = new Tween(mc, "_alpha", Regular.easeOut, 0, 100, 1, true);
mc._width = 80;
mc._height = 60;
};
mclThumb.addListener(lstThumb);

//
lstImg.onLoadStart = function(mc:MovieClip) {
mc._alpha = 0;
pre.bar._xscale = 0;
pre._visible = true;
};

lstImg.onLoadProgress = function(mc:MovieClip, loaded:Number, total:Number) {
var pct:Number = Math.round(loaded/total*100);
pre.bar._xscale = pct;
};

lstImg.onLoadInit = function(mc:MovieClip) {
pre._visible = false;
mc._x = (stageWidth-mc._width)/2;
mc._y = (stageHeight-mc._height)/2;
var amc:Tween = new Tween(mc, "_alpha", Regular.easeOut, 0, 100, 1, true);
amc.onMotionFinished = function() {
var cpt:String = new String(fn[idAtual].attributes.caption);
if (cpt == undefined || cpt == "undefined" || cpt == "") {
caption._y = (-caption._height);
} else {
caption.value = cpt;
var cy:Tween = new Tween(caption, "_y", Regular.easeOut, caption._y, 0, 1, true);
}
};
};

mclImg.addListener(lstImg);

//
xml.ignoreWhite = true;

xml.onLoad = function(sucess) {
if (sucess) {
fn = xml.firstChild.childNodes;
total = fn.length;
for (var j:Number = 0; j<total; j++) {
var btn:MovieClip = menu.thumb.attachMovie("thumb", "thumb"+j, j);
btn._x = (btn._width+space)*j;
btn.id = j;
btn.onRollOver = function() {
this.border.gotoAndStop(2);
};
btn.onRollOut = function() {
this.border.gotoAndStop(1);
};
btn.onRelease = function() {
loadImg(this.id);
};
mclThumb.loadClip(fn[j].attributes.thumb,btn.img);
}
loadImg(idAtual);
} else {
trace("Error!");
}
};

xml.load(xmlFile);

function loadImg(id:Number) {
idAtual = id;
for (var j:Number = 0; j<total; j++) {
menu.thumb["thumb"+j].enabled = true;
menu.thumb["thumb"+j].border.gotoAndStop(1);
menu.thumb["thumb"+j].thumbId._visible = false;
}
menu.thumb["thumb"+id].enabled = false;
menu.thumb["thumb"+id].border.gotoAndStop(3);
menu.thumb["thumb"+id].thumbId._visible = true;
menu.thumb["thumb"+id].thumbId.thumbId.text = menu.qtd.text=(idAtual+1)+" OF "+(total);
var cy:Tween = new Tween(caption, "_y", Regular.easeOut, caption._y, -caption._height, 1, true);
var ha:Tween = new Tween(holder, "_alpha", Regular.easeOut, holder._alpha, 0, 1, true);
ha.onMotionFinished = function() {
mclImg.loadClip(fn[id].attributes.src,holder);
};
}

//
nextBtn.onRelease = function() {
idAtual>=total-1 ? idAtual=0 : idAtual++;
loadImg(idAtual);
};

prevBtn.onRelease = function() {
idAtual<=0 ? idAtual=(total-1) : idAtual--;
loadImg(idAtual);
};
Cómo poner un botón extra en éste código para que me lea otro xml??

Un saludo, gracias