Ir para conteúdo

POWERED BY:

Arquivado

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

webpaulinho

Botao no Tickers

Recommended Posts

Salve galera, beleza???

 

Estou precisando de uma ajudinha básica, hehe!!!

 

Fiz um sistema de tickers com base do tutorial do antonio Barreto aqui no Imasters, porém estou usando swf no lugar de jpg.

E gostaria de fazer uma animação no botão de ticker individual, ou seja quando estiver no ticker1 o botao1 fica azul e os demais branco e assim em diante, parecido com os quadradinhos com os numeros 1,2 e 3 do sistema de tickers do site da Vivo.

Vou postar o endereço do meu sistema para vocês verem, o do tutorial, pois basicamente é o mesmo código que usei e do site da Vivo aqui embaixo.

 

Tutorial Imasters

Meu Sistema de Tickers

Site Vivo

 

Desde já agradeço.

 

Ae galera, alguém consegue me dar um auxilio?

Precisam que eu poste algum código?

Compartilhar este post


Link para o post
Compartilhar em outros sites

Se o quadradinho for um movieclip, você pode mandar ir pra um determinadoo frame, onde ele vai ta em outra cor, dependendo de algum evento.

Abs

Compartilhar este post


Link para o post
Compartilhar em outros sites

Fala Matheus, beleza?

 

Cara então, consegui aqui o problema dos botões, só que tive que usar um outro código, e agora to com dúvida de como fazer as ações dos botões ant_btn e prox_btn.

Tentei usando o código abaixo para o prox_btn, porém não deu muito certo, pois ele não pula para o 2º ticker, ele vai direto para o 3º e ficam se alterando entre o 1º e 3º. Já o ant_btn fica sempre voltando para o 1º.

 

Me dê um help onde estou errando.

 

prox_btn.onRelease = function():Void{ 
proximoTicker(); }; 

ant_btn.onRelease = function():Void { 
anteriorTicker(); };

function proximoTicker():Void { 
n  < total - 1 ? n++ : n = 0; 
insereDados(n); 
clearInterval(timeInterval); }

function anteriorTicker():Void { 
n  > 0 ? n-- : n = total - 1; 
insereDados(n); }

function insereDados(n:Number):Void  {
buildSlideshow(xmlData.firstChild.childNodes[i].childNodes[3].firstChild.nodeValue); 
}

O código do meu ticker é:

 

function loadXML(success) {
	if (success) {
		xmlNode = this.firstChild;
		description_x = [];
		description_y = [];
		description_w = [];
		picture_path = [];
		description = [];
		web_address = [];
		total = xmlNode.childNodes.length;
		for (i=0; i<total; i++) {
			description_x[i] = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue;
			description_y[i] = xmlNode.childNodes[i].childNodes[1].firstChild.nodeValue;
			description_w[i] = xmlNode.childNodes[i].childNodes[2].firstChild.nodeValue;
			picture_path[i] = xmlNode.childNodes[i].childNodes[3].firstChild.nodeValue;
			description[i] = xmlNode.childNodes[i].childNodes[4].firstChild.nodeValue;
			web_address[i] = xmlNode.childNodes[i].childNodes[5].firstChild.nodeValue;
		}
		delay_time = Number(this.firstChild.attributes.delay_time*3500);
		bgColor = this.firstChild.attributes.bgColor;
		BGcolor = new Color(background_mc);
		BGcolor.setRGB(bgColor);
		preloaderColor = this.firstChild.attributes.preloaderColor;
		PRLcolor = new Color(preloader);
		PRLcolor.setRGB(preloaderColor);
		holder_mc._x = 0;
		holder_mc._y = 0;
		menu_visible = this.firstChild.attributes.menu_visible;
		if (menu_visible == "no" || menu_visible == "NO") {
			slideMenu._visible = false;
		} else {
			slideMenu._visible = true;
		}
		menu_axis = this.firstChild.attributes.menu_axis;
		menu_x = Number(this.firstChild.attributes.menu_x);
		menu_y = Number(this.firstChild.attributes.menu_y);
		bannerBTN=this.firstChild.attributes.bannerBTN;
		if (bannerBTN == "no" || bannerBTN == "NO") {
			holder_mc.btn._visible = false;
		} else {
			holder_mc.btn._visible = true;
		}
		menu_spacer = Number(this.firstChild.attributes.menu_spacer);
		slideMenu._x = menu_x;
		slideMenu._y = menu_y;
		menu();
		slide();
	} else {
		holder_mc.description_txt.text = "CARREGANDO.... ";
	}
	delete xmlData;
}
start_x = 0;
start_y = 0;
function slide() {
	if (n == undefined || n == total) {
		n = 0;
	}
	clearInterval(timeInterval);
	menuColor(n);
	buildSlideshow(n);
	++n;
}
function menu() {
	for (i=0; i<total; i++) {
		slideMenu.attachMovie("menu_btn", "item"+i, i);
		item = slideMenu["item"+i];
		item.number_box.text = i+1;
		if (menu_axis == "x" || menu_axis == "X") {
			item._x = start_x;
		}
		if (menu_axis == "y" || menu_axis == "Y") {
			item._y = start_y;
		}
		start_x += menu_spacer+item._width;
		start_y += menu_spacer+item._height;
		item.num = i;
		item.onRelease = function() {
			clearInterval(timeInterval);
			slide(n=this.num);
		};
	}
}
function buildSlideshow(i) {
	holder_mc._alpha = 0;
	holder_mc.description_txt._x = description_x[i];
	holder_mc.description_txt._y = description_y[i];
	holder_mc.description_txt._width = description_w[i];
	holder_mc.picture_mc.loadMovie(picture_path[i]);

this.onEnterFrame = function() {
		preloader._alpha = 100;
		bLoaded = holder_mc.picture_mc.getBytesLoaded();
		bTotal = holder_mc.picture_mc.getBytesTotal();
		if (bLoaded<bTotal) {
			holder_mc._alpha = 0;
			preloader.loader_txt.htmlText = "CARREGANDO "+ Math.round(bLoaded/bTotal*100)+"%";
		} else if (bLoaded>=bTotal && bLoaded>100 && bTotal>100) {
			preloader._alpha = 0;
			if (holder_mc._alpha<100) {
				preloader.loader_txt.htmlText = "";
				holder_mc._alpha += 10;
			}
			if (holder_mc._alpha>=100) {
				timeInterval = setInterval(slide, delay_time);
				delete this.onEnterFrame;
			}
		}
	};
	if (holder_mc.description_txt.text == "" or holder_mc.description_txt.text == " ") {
		holder_mc.back_color._alpha = 0;
	} else {
		holder_mc.back_color._alpha = 100;
	}
	holder_mc.back_color._x = holder_mc.description_txt._x;
	holder_mc.back_color._y = holder_mc.description_txt._y;
	holder_mc.back_color._width = holder_mc.description_txt._width;
	holder_mc.back_color._height = holder_mc.description_txt._height;
}
function menuColor(n) {
	for (i=0; i<total; i++) {
		slideMenu["item"+i].gotoAndStop(1);
	}
	slideMenu["item"+n].gotoAndPlay("s1");
}

this.createEmptyMovieClip("slideMenu", this.getNextHighestDepth());
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("slideshow.xml");{

Alguém consegue me dizer onde estou errando??

 

Valeu!!

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.