Ir para conteúdo

POWERED BY:

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

sephir

[Resolvido] Ótima galeria XML,

Recommended Posts

Bom dia amigos,

 

Eu, recentemente, encontrei uma galeria free bem bacana feita em Flash + XML com Light Box e FullScreen, fiz umas mudanças nela na parte da posição que as tumbs aparecem, só que não estou conseguindo configurar ela para que apareça um numero x de tumb em cada linha . Ex: Tenho 15 imagens, quero que ela apareça 3 linhas de 5 imagens cada, mas como ela ta aqui ela aparece em apenas uma linha. Como devo proceder?

 

Segui a galeria

 

Obrigado e que Deus nos Abençoe

 

Vagner

Compartilhar este post


Link para o post
Compartilhar em outros sites

Bom dia, vou postar o codigo que estou com duvidas aqui

 

AS do FLA

 

Stage.scaleMode = "noScale";
Stage.align = "TL";

#include "AVbox.as"

//settings AVBox
AVBox.fileLoadingImage = "other/preloader.swf";
AVBox.animate = true;
AVBox.alphaSpeed = 5;
AVBox.borderSize = 10;
AVBox.v = false;

//
var file_xml:String = new String("aires.xml");
var photos:Array = new Array();
var captions:Array = new Array();
var sound:Sound = new Sound();
var xml:XML = new XML(file_xml);
//

var empty:MovieClip = this.createEmptyMovieClip("empty_", this.getNextHighestDepth());

//
xml.ignoreWhite = true;
xml.onLoad = function(sucess) {
	if (sucess) {
		fc = this.firstChild;
		total = fc.childNodes.length;
		sound.loadSound(fc.attributes.sound,false);
		sound.setVolume(fc.attributes.volume);
		//cleaning arrangements
		photos = [];
		captions = [];

		//total number of nodes
		AVBox.total = total;

		for (i=0; i<total; i++) {
			//
			photos.push(fc.childNodes[i].attributes.src);
			captions.push(fc.childNodes[i].attributes.caption);

			//informing the photos and captions
			AVBox.src = photos;
			AVBox.cap = captions;

			//
			var thumb:MovieClip = empty.attachMovie("thumb", "thumb"+i, i);
			thumb._x = i*(thumb._width+10);
			thumb.img.loadMovie(fc.childNodes[i].attributes.thumb);
			thumb.sd.alpha(30,2);
			thumb.id = i;
			thumb.onRollOver = function() {
				sound.start(0,1);
				this.sd.alpha(0,10);
			};
			thumb.onRollOut = function() {
				sound.stop();
				this.sd.alpha(30,10);
			};
			thumb.onRelease = function() {
				AVBox.v = true;

				//Starts AVBox
				Init_AVBox(this.id);
				this.sd.alpha(50,10);
			};
		}
		with (empty) {
			_x = "20";
			_y = "45";
		}
		fs._x = Stage.width-(fs._width+10);
		bg._width = Stage.width
	} else {
		trace("Error!");
	}
};
//_x = (Stage.height-_height)/"10";
//_y = (Stage.height-_height)/"10";

xml.load(file_xml);

//Put in the function you want to do, if the stage is resized.
function avBox_onResize() {
	with (empty) {
		_x = "20";
		_y = "45";
	}
	fs._x = Stage.width-(fs._width+10);
	bg._width = Stage.width
}

fs.onRollOver = function(){
	sound.start(0,1);
	this.gotoAndPlay(2);
}

fs.onRollOut = function(){
	sound.stop();
	this.gotoAndPlay(10);
}

fs.onRelease = function(){
	Stage["displayState"] = Stage["displayState"] == "fullScreen" ? "normal" : "fullScreen";
}

avBox_onResize();

E esse é o AS do AS externo

 

var AVBox:MovieClip = _root.createEmptyMovieClip("AVBox_", _root.getNextHighestDepth());
AVBox.onEnterFrame = function() {
	AVBox.v;
	this.animteSpeed = this.animteSpeed*100;
	if (this.borderSize<8 || this.borderSize == undefined) {
		this.borderSize = 8;
	}
	this.total;
	this.complete;
	if (this.total<=1) {
		next_bt_._visible = false;
		prev_bt_._visible = false;
	} else {
		if (target_.hitTest(_root._xmouse, _root._ymouse)) {
			if (bd_._xmouse>=(bd_._x+bd_._width)/2) {
				next_bt_._visible = true;
				prev_bt_._visible = false;
			} else {
				next_bt_._visible = false;
				prev_bt_._visible = true;
			}
		} else {
			next_bt_._visible = false;
			prev_bt_._visible = false;
		}
	}
	pre_._x = (Stage.width-pre_._width)/2;
	pre_._y = (Stage.height-pre_._height)/2;
	if (this.cap[this.id] == undefined) {
		caption_.text = "";
	} else {
		if (this.complete == true) {
			caption_.text = this.cap[this.id];
		} else {
			caption_.text = "";
		}
	}
	caption_.setTextFormat(fmt);
	fmt.font = "Arial";
	fmt.size = 11;
	fmt.bold = true;
};

var fmt:TextFormat = new TextFormat();

var lst:Object = new Object();
var mcl:MovieClipLoader = new MovieClipLoader();
lst.onLoadStart = function() {
	Key.removeListener(kl);
	pre_._x = (Stage.width-pre_._width)/2;
	pre_._y = (Stage.height-pre_._height)/2;
	pre_._visible = true;
	AVBox.complete = false;
};
lst.onLoadProgress = function() {
	removeMC();
};
lst.onLoadComplete = function() {
	AVBox.complete = true;
};
MovieClip.prototype.alpha = function(v, s) {
	this._alpha = 0;
	this.onEnterFrame = function() {
		this._alpha += s;
		if (this._alpha>=v) {
			delete this.onEnterFrame;
		}
	};
};

lst.onLoadInit = function(mc:MovieClip) {
	Key.addListener(kl);
	if (AVBox.animate == true) {
		mc.alpha(100,AVBox.alphaSpeed);
	} else {
		mc._alpha = 100;
	}
	var mcs_:Array = [bd_, pre_, target_, ctop_, cbottom_, prev_bt_, next_bt_];
	for (j=0; j<mcs_.length; j++) {
		mcs_[j]._visible = true;
	}
	pre_._visible = false;
	mc._y = (Stage.height-(mc._height+(AVBox.borderSize*2)))/2;
	mc._x = (Stage.width-mc._width)/2;
	bd_._width = mc._width+(AVBox.borderSize*2);
	bd_._height = mc._height+(AVBox.borderSize*4);
	bd_._x = (Stage.width-bd_._width)/2;
	bd_._y = mc._y-AVBox.borderSize;
	cbottom_._x = mc._x+mc._width-cbottom_._width;
	ctop_._x = mc._x+mc._width-ctop_._width+2;
	ctop_._y = mc._y-2;
	caption_._y = ((mc._y+mc._height)+((AVBox.borderSize*3)/2))-(caption_._height/2);
	cbottom_._y = ((mc._y+mc._height)+((AVBox.borderSize*3)/2))-(cbottom_._height/2);
	prev_bt_._x = mc._x-2;
	next_bt_._y = prev_bt_._y=mc._y+(mc._height/2)-(prev_bt_._height/2);
	next_bt_._x = mc._x+mc._width-next_bt_._width+2;
	caption_._x = mc._x;
};
mcl.addListener(lst);

function Init_AVBox(str) {
	var kl:Object = new Object();
	kl.onKeyDown = function() {
		switch (Key.getAscii()) {
			case 112 :
				prev_fn();
				break;
			case 110 :
				next_fn();
				break;
			case 99 :
				close_();
				break;
			case 120 :
				close_();
				break;
		}
		switch (Key.getCode()) {
			case Key.LEFT :
				prev_fn();
				break;
			case Key.RIGHT :
				next_fn();
				break;
			case Key.ESCAPE :
				close_();
				break;
		}
	};
	Key.addListener(kl);
	var bg:MovieClip = _root.createEmptyMovieClip("bg_", _root.getNextHighestDepth());
	with (bg) {
		beginFill(0x000000,100);
		lineTo(Stage.width,0);
		lineTo(Stage.width,Stage.height);
		lineTo(0,Stage.height);
		lineTo(0,0);
		_x = 0;
		_y = 0;
	}
	if (AVBox.animate == true) {
		bg_.alpha(70,AVBox.alphaSpeed);
	} else {
		bg_._alpha = 70;
	}
	var pre:MovieClip = this.createEmptyMovieClip("pre_", this.getNextHighestDepth());
	pre.loadMovie(AVBox.fileLoadingImage);
	pre._visible = false;
	var bd:MovieClip = this.createEmptyMovieClip("bd_", this.getNextHighestDepth());
	with (bd) {
		lineStyle(1,0x333333,70);
		beginFill(0xE5E5E5,100);
		lineTo(Stage.width,0);
		lineTo(Stage.width,Stage.height);
		lineTo(0,Stage.height);
		lineTo(0,0);
	}
	var target:MovieClip = this.createEmptyMovieClip("target_", this.getNextHighestDepth());
	var ctop:MovieClip = this.createEmptyMovieClip("ctop_", this.getNextHighestDepth());
	RoundedRect(ctop_,"<b>X</b>",0,0,20,20,6,0xE5E5E5,100);
	var cbottom:MovieClip = this.createEmptyMovieClip("cbottom_", this.getNextHighestDepth());
	RoundedRect(cbottom_,"<b><u>C</u>lose X</b>",0,0,50,20,6,0x666666,40);
	var next_btn:MovieClip = this.createEmptyMovieClip("next_bt_", this.getNextHighestDepth());
	RoundedRect(next_bt_,"<b><u>N</u>ext</b>",0,0,40,25,6,0xE5E5E5,100);
	next_bt_.onPress = next_fn;
	function next_fn() {
		if (AVBox.id>=AVBox.total-1) {
			AVBox.id = 0;
		} else {
			AVBox.id++;
		}
		mcl.loadClip(AVBox.src[AVBox.id],target_);
		removeMC();
	}
	var prev_btn:MovieClip = this.createEmptyMovieClip("prev_bt_", this.getNextHighestDepth());
	RoundedRect(prev_bt_,"<b><u>P</u>rev</b>",0,0,40,25,6,0xE5E5E5,100);
	prev_bt_.onPress = prev_fn;
	function prev_fn() {
		if (AVBox.id<=0) {
			AVBox.id = AVBox.total-1;
		} else {
			AVBox.id--;
		}
		mcl.loadClip(AVBox.src[AVBox.id],target_);
		removeMC();
	}
	var caption:TextField = this.createTextField("caption_", this.getNextHighestDepth(), 0, 0, 10, 20);
	with (caption) {
		autoSize = true;
		html = true;
		textColor = 0x666666;
		selectable = false;
		htmlText = cap;
		_x = Stage.width+_width;
		_y = Stage.height+_height;
		setTextFormat(fmt);
	}
	var mcs:Array = [bg_, pre_, bd_, target_, ctop_, cbottom_, prev_bt_, next_bt_];
	bd.onRelease = function() {
		if (this._xmouse>=(bd._x+bd._width)/2) {
			next_fn();
		} else {
			prev_fn();
		}
	};
	bg.onRelease = cbottom.onRelease=ctop.onRelease=close_;
	function close_() {
		AVBox.v = false;
		caption_.removeTextField();
		for (i=0; i<mcs.length; i++) {
			mcs[i].removeMovieClip();
		}
		Key.removeListener(kl);
	}
	bg.useHandCursor = bd.useHandCursor=target.useHandCursor=false;
	var mcs_:Array = [bd_, pre_, target_, ctop_, cbottom_, prev_bt_, next_bt_];
	for (j=0; j<mcs_.length; j++) {
		mcs_[j]._visible = false;
	}
	mcl.loadClip(AVBox.src[str],target_);
	AVBox.id = str;
}

var st:Object = new Object();
st.onResize = function() {
	bg_._width = Stage.width;
	bg_._height = Stage.height;
	bg_._x = 0;
	bg_._y = 0;
	pre_._x = (Stage.width-pre_._width)/2;
	pre_._y = (Stage.height-pre_._height)/2;
	target_._y = (Stage.height-(target_._height+(AVBox.borderSize*2)))/2;
	target_._x = (Stage.width-target_._width)/2;
	bd_._x = (Stage.width-bd_._width)/2;
	bd_._y = target_._y-AVBox.borderSize;
	cbottom_._x = target_._x+target_._width-cbottom_._width;
	ctop_._x = target_._x+target_._width-ctop_._width+2;
	ctop_._y = target_._y-2;
	caption_._y = ((target_._y+target_._height)+((AVBox.borderSize*3)/2))-(caption_._height/2);
	cbottom_._y = ((target_._y+target_._height)+((AVBox.borderSize*3)/2))-(cbottom_._height/2);
	prev_bt_._x = target_._x-2;
	next_bt_._y = prev_bt_._y=target_._y+(target_._height/2)-(prev_bt_._height/2);
	next_bt_._x = target_._x+target_._width-next_bt_._width+2;
	caption_._x = target_._x;
	avBox_onResize();
};
Stage.addListener(st);

function removeMC() {
	var mcs_:Array = [bd_, target_, ctop_, cbottom_, prev_bt_, next_bt_];
	for (j=0; j<mcs_.length; j++) {
		mcs_[j]._visible = false;
	}
	caption_._x = Stage.width+caption_._width+caption_._x;
	caption_._y = Stage.height+caption_._height+caption_._y;
}


function RoundedRect(mc:MovieClip, str:String, x:Number, y:Number, w:Number, h:Number, r:Number, c:Number, b:Number) {
	with (mc) {
		beginFill(c,B);
		var a = r-(r*Math.sin(45));
		var s = r-(r*Math.cos(45));
		moveTo(x+w,y+h-r);
		lineTo(x+w,y+h-r);
		curveTo(x+w,y+h-s,x+w-a,y+h-a);
		curveTo(x+w-s,y+h,x+w-r,y+h);
		lineTo(x+r,y+h);
		curveTo(x+s,y+h,x+a,y+h-a);
		curveTo(x,y+h-s,x,y+h-r);
		lineTo(x,y+r);
		curveTo(x,y+s,x+a,y+a);
		curveTo(x+s,y,x+r,y);
		lineTo(x+w-r,y);
		curveTo(x+w-s,y,x+w-a,y+a);
		curveTo(x+w,y+s,x+w,y+r);
		lineTo(x+w,y+h-r);
	}
	mc.createTextField("name",mc.getNextHighestDepth(),0,0,10,20);
	with (mc.name) {
		autoSize = true;
		html = true;
		textColor = 0x666666;
		selectable = false;
		htmlText = str;
		_x = (mc._width-_width)/2;
		_y = (mc._height-_height)/2;
		setTextFormat(fmt);
	}
}

Lembrando que a minha duvida é fazer com que eu possa limitar o numero de tumbs que aparece em cada linha

 

Walew

Compartilhar este post


Link para o post
Compartilhar em outros sites

Veja se é isso que você quer:

 

xml.onLoad = function(sucess) {
	if (sucess) {
		fc = this.firstChild;
		total = fc.childNodes.length;
		sound.loadSound(fc.attributes.sound,false);
		sound.setVolume(fc.attributes.volume);
		//cleaning arrangements
		photos = [];
		captions = [];
		var linha:Number = 0;
		var posx: Number = 0;
		var colunas: Number = 5;

		//total number of nodes
		AVBox.total = total;

		for (i=0; i<total; i++) {
			//
			photos.push(fc.childNodes[i].attributes.src);
			captions.push(fc.childNodes[i].attributes.caption);

			//informing the photos and captions
			AVBox.src = photos;
			AVBox.cap = captions;
			
			// Verifica se é hora de pular linha e zerar o _x
			if(i % colunas == 0 && i > 0){
				linha ++;
				posx = 0;
			}

			//
			var thumb:MovieClip = empty.attachMovie("thumb", "thumb"+i, i);
			thumb._x = posx;
			thumb._y = linha * (thumb._width+5);
			thumb.img.loadMovie(fc.childNodes[i].attributes.thumb);
			thumb.sd.alpha(30,2);
			thumb.id = i;
			
			posx += thumb._width + 5;
			
			thumb.onRollOver = function() {
				sound.start(0,1);
				this.sd.alpha(0,10);
			};
			thumb.onRollOut = function() {
				sound.stop();
				this.sd.alpha(30,10);
			};
			thumb.onRelease = function() {
				AVBox.v = true;

				//Starts AVBox
				Init_AVBox(this.id);
				this.sd.alpha(50,10);
			};
		}
		with (empty) {
			_x = "20";
			_y = "45";
		}
		fs._x = Stage.width-(fs._width+10);
		bg._width = Stage.width
	} else {
		trace("Error!");
	}
};

Compartilhar este post


Link para o post
Compartilhar em outros sites

Veja se é isso que você quer:

 

xml.onLoad = function(sucess) {
	if (sucess) {
		fc = this.firstChild;
		total = fc.childNodes.length;
		sound.loadSound(fc.attributes.sound,false);
		sound.setVolume(fc.attributes.volume);
		//cleaning arrangements
		photos = [];
		captions = [];
		var linha:Number = 0;
		var posx: Number = 0;
		var colunas: Number = 5;

		//total number of nodes
		AVBox.total = total;

		for (i=0; i<total; i++) {
			//
			photos.push(fc.childNodes[i].attributes.src);
			captions.push(fc.childNodes[i].attributes.caption);

			//informing the photos and captions
			AVBox.src = photos;
			AVBox.cap = captions;
			
			// Verifica se é hora de pular linha e zerar o _x
			if(i % colunas == 0 && i > 0){
				linha ++;
				posx = 0;
			}

			//
			var thumb:MovieClip = empty.attachMovie("thumb", "thumb"+i, i);
			thumb._x = posx;
			thumb._y = linha * (thumb._width+5);
			thumb.img.loadMovie(fc.childNodes[i].attributes.thumb);
			thumb.sd.alpha(30,2);
			thumb.id = i;
			
			posx += thumb._width + 5;
			
			thumb.onRollOver = function() {
				sound.start(0,1);
				this.sd.alpha(0,10);
			};
			thumb.onRollOut = function() {
				sound.stop();
				this.sd.alpha(30,10);
			};
			thumb.onRelease = function() {
				AVBox.v = true;

				//Starts AVBox
				Init_AVBox(this.id);
				this.sd.alpha(50,10);
			};
		}
		with (empty) {
			_x = "20";
			_y = "45";
		}
		fs._x = Stage.width-(fs._width+10);
		bg._width = Stage.width
	} else {
		trace("Error!");
	}
};

DAe Carnerinho, beleza?

 

Eu coloquei o seu codigo e agora ele não aparece nenhuma tumb.

 

Obrigado

Compartilhar este post


Link para o post
Compartilhar em outros sites

É pra você só substituir a parte do onLoad, aqui funcionou bem :) você deve ter trocado o script inteiro

 

Carneirinho, eu coloquei do " xml.onLoad = function(sucess) {" em diante

e não aparece nada

postei o fla la no começo se quizer usar

 

Valew

 

Fiquem com Deus

Compartilhar este post


Link para o post
Compartilhar em outros sites

 

Subi o exemplo funcionando pra você, da uma olhada http://rapidshare.com/files/360723071/avbox.zip.html

 

Nossa, não estou conseguindo baixar pq diz que muitas pessoas ja estão ou baixaram o arquivo e é para mim esperar ....hahahahha

 

Vou comparar os AS pra ver onde eu errei

 

Valew

 

Fiquem com Deus

 

Bom dia,

 

Nossa, tava em cs4, ainda bem que consegui converter aqui. deucerto aqui tb amigo, muito obrigado.

Agora vou fazer meus testes aqui pra ver oq mais consigo dessa galeria.

 

Valew

 

Fiquem com Deus

Compartilhar este post


Link para o post
Compartilhar em outros sites

 

 

Subi o exemplo funcionando pra você, da uma olhada http://rapidshare.com/files/360723071/avbox.zip.html

 

Nossa, não estou conseguindo baixar pq diz que muitas pessoas ja estão ou baixaram o arquivo e é para mim esperar ....hahahahha

 

Vou comparar os AS pra ver onde eu errei

 

Valew

 

Fiquem com Deus

 

Bom dia,

 

Nossa, tava em cs4, ainda bem que consegui converter aqui. deucerto aqui tb amigo, muito obrigado.

Agora vou fazer meus testes aqui pra ver oq mais consigo dessa galeria.

 

Valew

 

Fiquem com Deus

 

Muito obrigado Carneirinho, eu abri, analizei e auterei como quiz aqui.

 

Esse forum é 10

 

Fiquem com Deus

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.