Ir para conteúdo

POWERED BY:

Arquivado

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

Thiago Bittencourt

[Resolvido] Galeria de Imagens

Recommended Posts

Olá galera,

 

To com um problema daqueles de f**** com a vida huahuahua..

o pessual aqui do trampo pego uma galeria pronta e pediu pra alterar...

mas o problema é que eu so consegui alterar o layout...

O que eles querem... a principio quando clica na imagem 2x ela fica grande, quando fica grande eles querem que se a pessoa clicar na foto vai pra outra página...

Segue o link com o modelo que eu to usando: http://www.no3dfx.com/polaroid/

 

Abaixo segue o código:

 

import flash.filters.*;
import flash.display.BitmapData;

var photoHolder = new Array();
var skalerTempo = 3;
var thumbStr = 30;
var stageHeight = Stage.height;
var stageWidth = Stage.width;
/*var fotoSkygge:DropShadowFilter = new DropShadowFilter(0, 20, 0x333333, 0.8, 5, 5, 2, 10);*/
/*var glow:GlowFilter = new GlowFilter(0x333333,100,150,150,1.5,3,true,true);*/
var bakgrunnPattern:BitmapData = BitmapData.loadBitmap("bakgrunn");

_root.createEmptyMovieClip("bakgrunsHolder",_root.getNextHighestDepth());
_root.createEmptyMovieClip("sideGlow",_root.getNextHighestDepth());

flickrTAGS = (flickrTAGS) ? flickrTAGS : "";
xmlURL = (xmlURL) ? xmlURL : "_xml/photos.xml";
xmlURL = (flickrID) ? "http://api.flickr.com/services/feeds/photos_public.gne?id="+flickrID+"&tags="+flickrTAGS+"&tagmode=any&format=rss_200" : xmlURL;

var loadet_xml:XML = new XML();
loadet_xml.ignoreWhite = true;
loadet_xml.onLoad = function(success) {
	var loop = (flickrID) ? loadet_xml.firstChild.firstChild.childNodes : loadet_xml.firstChild.childNodes;
	var num = 0;
	if (flickrID) {
		for (var i = 0; i<loop.length; i++) {
			if (loop[i].nodeName == "item") {
				var loop2 = loop[i].childNodes;
				photoHolder[num] = new Array();
				for (var i2 = 0; i2<loop2.length; i2++) {
					if (loop2[i2].nodeName == "media:content") {
						photoHolder[num].url = loop2[i2].attributes.url;
					} else if (loop2[i2].nodeName == "title") {
						photoHolder[num].desc = loop2[i2].firstChild;
					}
				}
				num++;
			}
		}
	} else {
		for (i=0; i<loop.length; i++) {
			photoHolder[i] = loop[i].attributes;
		}
	}
	delete loadet_xml;
	byggBilder();
};
loadet_xml.load(xmlURL);

function byggBilder() {
	for (i=0; i<photoHolder.length; i++) {
		mc = _root.attachMovie("fotoHolder", "fotoHolder"+i, _root.getNextHighestDepth(), {_xscale:thumbStr, _yscale:thumbStr, _rotation:30-60*Math.random()});
		mc.txt.text = photoHolder[i].desc;
		if (Math.round(Math.random()*1) == 1) {
			// tilfeldig y akse
			mc._y = (Stage.height*Math.random())+(mc._height*2);
			if (Math.round(Math.random()*1) == 1) {
				mc._x = Stage.width+(mc._width*2);
			} else {
				mc._x = -(mc._width*2);
			}
		} else {
			// tilfeldig x akse
			mc._x = (Stage.width*Math.random())+(mc._width*2);
			if (Math.round(Math.random()*1) == 1) {
				mc._y = Stage.height+(mc._height*2);
			} else {
				mc._y = -(mc._height*2);
			}
		}
		mc.newX = Math.round((mc._width/2)+(Stage.width-mc._width)*Math.random());
		mc.newY = Math.round((mc._height/2)+(Stage.height-mc._height)*Math.random());
		mc.oldRotation = mc._rotation;
		mc.oldX = mc.newX;
		mc.oldY = mc.newY;
		mc.startX = mc._x;
		mc.startY = mc._y;
		mc.oldHeight = mc._yscale;
		mc.oldWidth = mc._xscale;
		mc.id = i;
		mc.onEnterFrame = fotoAnimer;
		mc.filters = [fotoSkygge];
		mc.dragPol.onPress = drag;
		mc.dragPol.onReleaseOutside = mc.dragPol.onRelease=stopdrag;
		photoHolder[i].mc = mc;
		lastBilde(mc,photoHolder[i].url);
		delete mc;
	}
	antallBilder = i;
}
function lastBilde(mc, url) {
	mc.createEmptyMovieClip("tmp",mc.getNextHighestDepth());
	lastBildeH.loadClip(url,(flickrID) ? mc.bildeHolder : mc.tmp);
}
var lastBildeH:MovieClipLoader = new MovieClipLoader();
var lastBildeHL:Object = new Object();
lastBildeHL.onLoadStart = function(mc:MovieClip):Void  {
	mc._parent.attachMovie('preLoader','preloader',mc._parent.getNextHighestDepth());
	loaderFarge = new Color(mc._parent.preloader);
	mc._parent.preloader.loadtxt.text = "";
	loaderFarge.setRGB(0xFFFFFF);
	mc._parent.preloader._y = -10;
	mc._visible = false;
};
lastBildeHL.onLoadProgress = function(mc:MovieClip, numBytesLoaded:Number, numBytesTotal:Number):Void  {
	var numPercentLoaded:Number = numBytesLoaded/numBytesTotal*100;
	mc._parent.preloader.percent._width = numPercentLoaded;
};
lastBildeHL.onLoadInit = function(mc:MovieClip) {
	mc._parent.preloader.removeMovieClip();
	var mc2 = mc._parent.bildeHolder;
	if (!flickrID) {
		var myBitmap = new BitmapData(mc._width, mc._height, true, 0xFFFFFF);
		myBitmap.draw(mc);
		mc._parent.bildeHolder.attachBitmap(myBitmap,mc._parent.bildeHolder.getNextHighestDepth(),"auto",true);
		mc.removeMovieClip();
	}

	var wP = 468/mc2._width;
	var hP = 450/mc2._height;
	mc2._width *= (wP<hP) ? hP : wP;
	mc2._height *= (wP<hP) ? hP : wP;
	mc2._x += -((mc2._width-468)/2);
	mc2._y += -((mc2._height-450)/2);
	mc2._visible = true;
};
lastBildeH.addListener(lastBildeHL);

function rensFilm() {
	for (i=0; i<antallBilder; i++) {
		mc = eval("fotoHolder"+i);
		mc.oldY = mc.startY;
		mc.oldX = mc.startX;
		mc.onEnterFrame = fotoAnimerTilbake;
		removeMovieClip(navigering);
	}
}
// Animação de inicio das fotos.
function fotoAnimer() {
	this._y += (this.newY-this._y)/skalerTempo;
	this._x += (this.newX-this._x)/skalerTempo;
	if (Math.round(this._y) == this.newY) {
		delete this.onEnterFrame;
	}
}
// Animação pra foto voltar quando estiver grande!
function fotoAnimerTilbake() {
	this._y += (this.oldY-this._y)/skalerTempo;
	this._x += (this.oldX-this._x)/skalerTempo;
	this._xscale += (this.oldWidth-this._xscale)/skalerTempo;
	this._yscale += (this.oldHeight-this._yscale)/skalerTempo;
	this._rotation += (this.oldRotation-this._rotation)/skalerTempo;
	this.nesteKnapp._alpha += (0-this.nesteKnapp._alpha)/skalerTempo;
	this.forrigeKnapp._alpha += (0-this.forrigeKnapp._alpha)/skalerTempo;
	if ((Math.round(this._y) == this.oldY) && (Math.round(this._x) == this.oldX)) {
		delete this.nesteKnapp.onRelease;
		getURL("http://www.imasters.com.br", "_blank");
		delete this.forrigeKnapp.onRelease;
		delete this.onEnterFrame;
	}
}
// Função que faz a imagem crescer após dar 2 cliques.
function fotoSkaler() {
	this._xscale += (100-this._xscale)/skalerTempo;
	this._yscale += (100-this._yscale)/skalerTempo;
	this._rotation += (this.newRotation-this._rotation)/skalerTempo;
	this._x += ((Stage.width/2)-this._x)/skalerTempo;
	this._y += ((Stage.height/2)-this._y)/skalerTempo;
	this.nesteKnapp._alpha += (60-this.nesteKnapp._alpha)/skalerTempo;
	this.forrigeKnapp._alpha += (60-this.forrigeKnapp._alpha)/skalerTempo;
	if (Math.round(this._width) == this.newWidth) {
		delete this.onEnterFrame;
	}
}
//Função pra arrastar a imagem.
function drag() {
	if ((fotoSomBlirVist != this._parent) && (!this._parent.onEnterFrame)) {
		this._parent.startDrag();
	}
	if (!this.click) {
		this.click = true;
		this.timer = getTimer()/1000;
	} else {
		this.timer2 = getTimer()/1000;
		if ((this.timer2-this.timer)<.25) {
			visFoto(this._parent);
		} else {
			this.timer = getTimer()/1000;
			this.click = true;
		}
	}
	this._parent.swapDepths(_root.getNextHighestDepth());
	if (fotoSomBlirVist) {
		fotoSomBlirVist.swapDepths(_root.getNextHighestDepth());
	}
}
// Função pra parar de arrastar a imagem.
function stopdrag() {
	mc = this._parent;
	mc.stopDrag();
	if ((fotoSomBlirVist != mc) && (!mc.onEnterFrame)) {
		mc.oldX = Math.round(mc._x);
		mc.oldY = Math.round(mc._y);
	}
}
function visFoto(mc:MovieClip) {
	if (fotoSomBlirVist == mc) {
		fotoSomBlirVist.onEnterFrame = fotoAnimerTilbake;
		delete fotoSomBlirVist;
	} else {
		fotoSomBlirVist.onEnterFrame = fotoAnimerTilbake;
		mc.newRotation = 0;
		mc.oldRotation = mc._rotation;
		mc.nesteKnapp.onRelease = function() {
			visNeste();
		};
		mc.forrigeKnapp.onRelease = function() {
			visForrige();
		};
		mc.onEnterFrame = fotoSkaler;
		fotoSomBlirVist = mc;
	}
	if (fotoSomBlirVist) {
		fotoSomBlirVist.swapDepths(_root.getNextHighestDepth());
		trace("opa");
	}
}
function visNeste() {
	var nb = 0;
	if (fotoSomBlirVist) {
		nb = fotoSomBlirVist.id+1;
		if (nb == antallBilder) {
			nb = 0;
		}
	}
	visFoto(eval("fotoHolder"+nb));
}
function visForrige() {
	var fb = 0;
	if (fotoSomBlirVist) {
		fb = fotoSomBlirVist.id-1;
		if (fb<0) {
			fb = antallBilder-1;
		}
	}
	visFoto(eval("fotoHolder"+fb));
}
var stageL:Object = new Object();
stageL.onResize = function() {
	for (i=0; i<antallBilder; i++) {
		mc = eval("fotoHolder"+i);
		if (mc != fotoSomBlirVist) {
			mc._x = Math.round(Stage.width*(mc._x/stageWidth));
			mc._y = Math.round(Stage.height*(mc._y/stageHeight));
		} else {
			fotoSomBlirVist._x = Stage.width/2;
			fotoSomBlirVist._y = Stage.height/2;
		}
		mc.oldX = Math.round(Stage.width*(mc.oldX/stageWidth));
		mc.oldY = Math.round(Stage.height*(mc.oldY/stageHeight));
		mc.newX = Math.round(Stage.width*(mc.newX/stageWidth));
		mc.newY = Math.round(Stage.height*(mc.newY/stageHeight));
		mc.startX = Math.round(Stage.width*(mc.startX/stageWidth));
		mc.startY = Math.round(Stage.height*(mc.startY/stageHeight));
	}
	stageWidth = Stage.width;
	stageHeight = Stage.height;
	fillBG();
	fyllGlow();
};
Stage.addListener(stageL);

desde de já agradeço!

Compartilhar este post


Link para o post
Compartilhar em outros sites

Galera pode fechar o post... Arrumei aqui, Eu tinha feito uma bagunça no código...rsrs Eu repensei tudo e daí deu certo. Valeu.

Novo Action:

 

//importa a descrição
descriptions = true;
//importa o link
link = true;
// caixa da descrição
alert._visible = true;
var ease = 5;
_root.scala_x = 80;
_root.scala_y = 80;
_root.barra_stato = "true";
_root.box.useHandCursor = false;
thumbs = new XML();
thumbs.ignoreWhite = true;
thumbs.load("galeria.xml");
_info.push( new Array( link ) );
thumbs.onLoad = function() {
	root = this.firstChild;
	total = root.childNodes.length;
	displayNum = Number(root.childNodes[0].attributes.displayNum);
	separation = Number(root.childNodes[0].attributes.separation);
	w = 60;
	h = 55;
	mask._width = displayNum*(w+separation);
	mask._height = h+30;
	forward._x = mask._width+20;
	forward._y = back._y=h/2;
	mcs = [];
	for (i=0; i<total; i++) {
		mcs.push(i);
		newThumb = thumbnailer.container.duplicateMovieClip("container"+i, i);
		with (newThumb) {
			_x = (w+separation)*i;
			preloader._x = w/2;
			preloader._y = h/2;
			shape._width = w;
			shape._height = h;
		}
		var image = root.childNodes[i].childNodes[0].firstChild.nodeValue;
		var image1 = root.childNodes[0].childNodes[0].firstChild.nodeValue;
		var link = root.childNodes[0].childNodes[2].firstChild.nodeValue;
		newThumb.image = root.childNodes[i].childNodes[0].firstChild.nodeValue;
		alert.desc = root.childNodes[0].childNodes[1].firstChild.nodeValue;
		newThumb.linkclick = root.childNodes[i].childNodes[2].firstChild.nodeValue;
		linksite.linkclick = root.childNodes[0].childNodes[2].firstChild.nodeValue;
		loadMovie(image1, _root.box.foto_effetto);
		_root.box._xscale = _root.scala_x;
		_root.box._yscale = _root.scala_y;
		newThumb.onRelease();
		newThumb.cont.loadMovie(image);
		newThumb.cont2.loadMovie(image);
		newThumb.cont._xscale = 8.2;
		newThumb.cont._yscale = 12.2;
		newThumb.cont2._xscale = newThumb.cont._xscale;
		newThumb.cont2._yscale = newThumb.cont._yscale;
		newThumb.onRelease = function() {

			alert.desc = this.desc;
			linksite.linkclick = this.linkclick;
			
			loadMovie(this.image, _root.box.foto_effetto);
			_root.box.play();
			_root.box._xscale = _root.scala_x;
			_root.box._yscale = _root.scala_y;
		};
		if (descriptions) {
			newThumb.onRollOver = function() {
				this._xscale = 120;
				this._yscale = 120;
				this._y = this._y-10;
				this._x = this._x-5;
				this.swapDepths(9);
			};
			newThumb.onRollOut = function() {
				this._xscale = 100;
				this._yscale = 100;
				this._y = this._y+10;
				this._x = this._x+5;
			};
		}
	}
	//
	var offset = total-1;
	var dest = 0;
	var increment = w+separation;
	var ending = (total-displayNum)*(w+separation);
	var lastmc = total-1;
	var firstmc = 0;
	back.onRelease = function() {
		if (dest<0) {
			dest += increment;
		} else {
			first = mcs[0];
			for (k=0; k<total; k++) {
				mcs[k] = mcs[k+1];
			}
			mcs[total-1] = first;
			thumbnailer["container"+lastmc]._x = -(w+separation);
			firstmc = lastmc;
			for (k=0; k<total; k++) {
				if (mcs[k] == (total-1)) {
					lastmc = k;
				}
			}
		}
	};
	forward.onRelease = function() {
		if (dest>-ending) {
			dest -= increment;
		} else {
			last = mcs[total-1];
			for (k=1; k<total; k++) {
				mcs[total-k] = mcs[total-k-1];
			}
			mcs[0] = last;
			thumbnailer["container"+firstmc]._x = (displayNum)*(w+separation);
			lastmc = firstmc;
			for (k=0; k<total; k++) {
				if (mcs[k] == 0) {
					firstmc = k;
				}
			}
		}
	};
	//movement
	onEnterFrame = function () {
		for (j=0; j<total; j++) {
			thumbnailer["container"+j]._x += (dest+(mcs[j])*(w+separation)-thumbnailer["container"+j]._x)/ease;
		}
	};
};

Obrigado...

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.