Foros del Web » Creando para Internet » Flash y Actionscript »

Ayuda con galeria flash y xml boton next / prev

Estas en el tema de Ayuda con galeria flash y xml boton next / prev en el foro de Flash y Actionscript en Foros del Web. Hola amigos tengo este código pero no logro hacer funcionar el botón adelante atras de la galería, seguramente es algo muy simple pero no encuentro ...
  #1 (permalink)  
Antiguo 26/10/2009, 11:37
 
Fecha de Ingreso: agosto-2005
Ubicación: Rosario
Mensajes: 5
Antigüedad: 18 años, 7 meses
Puntos: 0
Busqueda Ayuda con galeria flash y xml boton next / prev

Hola amigos tengo este código pero no logro hacer funcionar el botón adelante atras de la galería, seguramente es algo muy simple pero no encuentro la solución

Código HTML:
System.useCodepage = true;

var tnNr;
spacing = 20;
container._alpha = 0;
var curLength;
var cur;
info.autoSize = true;
MovieClip.prototype.loadPic = function(pic, id) {
	info.text = "";
	this._alpha = 0;
	this.loadMovie(pic);
	cur = pic;
	temp = this._parent.createEmptyMovieClip("temp2", 998);
	temp.onEnterFrame = function() {
		var t = container.getBytesTotal(), l = container.getBytesLoaded();
		cont1.bar._visible = 1;
		cont1.per = Math.round((l/t)*100);
		if (Math.round(l/t) == 1 && container._width != 0 && container._height != 0) {
			var w = container._width+spacing, h = container._height+spacing;
			border.resizeMe(w, h, id);
			cont1.bar._visible = 0;
			delete this.onEnterFrame;
			} else {
			//cont1.bar._width = cont1.per;
			//gives the bar a max width 100 
			info_mc.info.text = per+" % loaded";
		}
	};
};
MovieClip.prototype.resizeMe = function(w, h, id) {
	trace(w);
	var speed = 3;
	container._alpha = 0;
	this.onEnterFrame = function() {
		this._width += (w-this._width)/speed;
		this._height += (h-this._height)/speed;
		if (Math.abs(this._width-w)<1 && Math.abs(this._height-h)<1) {
			this._width = w;
			this._height = h;
			container._x = this._x-this._width/2+spacing/2;
			container._y = this._y-this._height/2+spacing/2;
			container._alpha += 5;
			if (container._alpha>90) {
				info.htmlText = id;
				container._alpha = 100;
				delete this.onEnterFrame;
			}
		}
	};
};
function galleryChoice(q) {
	cur = 0;
	t1Array = new Array();
	pArray = new Array();
	tArray = new Array();
	iArray = new Array();
	my_xml = new XML();
	for (var j = 0; j<curLength; j++) {
		this.th_nav["thmb"+j].removeMovieClip();
	}
	my_xml.ignoreWhite = true;
	my_xml.onLoad = function(loaded) {
		if (loaded) {
			gallery = this.firstChild.childNodes[q];
			curLength = gallery.childNodes.length;
			for (var i = 0; i<gallery.childNodes.length; i++) {
				titulo.titulo_txt = gallery.attributes.titulo;
				pArray.push(gallery.childNodes[i].attributes.source);
				tArray.push(gallery.childNodes[i].attributes.titulo);
				iArray.push(gallery.childNodes[i].attributes.title);
			}
		}
		delay = setInterval(makeButtons, 50);
	};
	my_xml.load("gallery.xml");
}

if (titulo.titulo_txt.htmlText == "" || titulo.titulo_txt.htmlText == "undefined") {
titulo._visible = false;
} else {
titulo.play();
}

function makeButtons() {
	tnNr = 0;
	cur = 0;
	clearInterval(delay);
	for (var i = 0; i<tArray.length; i++) {
		var thb = th_nav.thmb.duplicateMovieClip("thmb"+i, 1000+i);
		thb.id = i;
		thb._x = i%1*100;
		thb._y = Math.floor(i/1)*18;
	}
	loadButtons();
}
function loadButtons() {
	var tbox = th_nav["thmb"+tnNr];
	th_nav["thmb"+tnNr].titulo_mc.bt_titulo.text=(tArray[tnNr]);
	temp = this.createEmptyMovieClip("tmp"+tnNr, 999);
	temp.onEnterFrame = function() {
		bt = tbox.getBytesTotal();
		bl = tbox.getBytesLoaded();
		if (bl != bt)
		//Si todavía no cargo el picture
		{
		porcentaje_mc._visible = true;
		porcentaje_mc.porcentaje.text = "CARGANDO "+(tnNr+1)+" DE "+tArray.length;
		}
		else
		//Si ya cargo el picture
		{
		porcentaje_mc._visible = false;
		}
		if (bt == bl && bt>4) {
			nextButton();
			delete this.onEnterFrame;
		}
	};
}
function nextButton() {
	if (tnNr<tArray.length-1) {
		tnNr++;
		loadButtons();
	} else {
		activateButtons();
	}
}
function activateButtons() {
	mainButtons();
	for (var i = 0; i<pArray.length; i++) {
		var but = th_nav["thmb"+i];
		but.id = i;
		but.onRelease = function() {
			container.loadPic(pArray[this.id], iArray[this.id]);
			disButtons2(this.id);
		};
		but.onRollOver = function() {
			this.titulo_mc.play();
		};
		but.onRollOut = function() {
			this.titulo_mc.gotoAndStop("activo");
		};
	}
	container.loadPic(pArray[0], iArray[0]);
	disButtons2(0);
}
var butArray:Array = ["but1", "but2", "but3"];
function mainButtons() {
	for (var i = 0; i<butArray.length; i++) {
		this[butArray[i]].id = i;
		this[butArray[i]].onRelease = function() {
			galleryChoice(this.id);
			disButtons(this.id);
		};
	}
}

function disButtons2(d) {
	for (var i = 0; i<tArray.length; i++) {
		if (i != d) {
			this.th_nav["thmb"+i].enabled = true;
			this.th_nav["thmb"+i].titulo_mc.gotoAndStop("activo");
		} else {
			this.th_nav["thmb"+i].enabled = false;
			this.th_nav["thmb"+i].titulo_mc.gotoAndStop("inactivo");
		}
	}
}
function disButtons(d) {
	for (var i = 0; i<butArray.length; i++) {
		if (i != d) {
			this[butArray[i]].enabled = true;
			this[butArray[i]].gotoAndStop("activo");
		} else {
			this[butArray[i]].enabled = false;
			this[butArray[i]].gotoAndStop("inactivo");
		}
	}
}
disButtons(0);
galleryChoice(0);

prevb.onRelease = function() {
	cur--;
	if (cur<0) {
		container.loadPic(curLength-1);
	} else {
		container.loadPic(cur);
	}
};
nextb.onRelease = function() {
	cur++;
	if (cur>curLength-1) {
		container.loadPic(0);
	} else {
		container.loadPic(cur);
	}
};
Desde ya saludos y espero de algún alma caritativa que me ayude.
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 09:20.