Ir para conteúdo

Arquivado

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

Luiz Castelli

Link em galeria XML

Recommended Posts

olá, não estou conseguindo por link nas fotos da galeria para ampliar :unsure:

 

no flash esta assim

images_xml = new XML();

images_xml.onLoad = startImageViewer;

images_xml.load("xml/images.xml");

images_xml.ignoreWhite = true;

//

// Show the first image and intialize variables

function startImageViewer(success) {

if (success == true) {

rootNode = images_xml.firstChild;

// 'totalImages' is the variable name set to correspond with the the dynamic text instance of 'totalImages'

totalImages = rootNode.childNodes.length;

// [ totalImages = rootNode.childNodes.length; ] gets the total number of childNodes (total number of image and text files) in your .xml document

firstImageNode = rootNode.firstChild;

currentImageNode = firstImageNode;

// 'currentIndex' is the variable name set to correspond with the dynamic text instance of 'currentIndex'

currentIndex = 1;

// [ currentIndex = 1; ] sets the viewer to play the first childNode (first image and text file) in your .xml document

updateImage(firstImageNode);

}

}

//

// Updates the current image with new image and text

function updateImage(newImageNode) {

// 'imagePath' is the variable name set to correspond with the .jpeg file name located in your .xml document

imagePath = newImageNode.attributes.jpegURL;

// 'imageText' is the variable name for the instance 'textArea'

imageText = newImageNode.firstChild.nodeValue;

// 'targetClip' is the instance name for the movie clip 'imageArea', this is where all your image files from your .xml document are loaded

targetClip.loadMovie(imagePath);

// IMPORTANT : RESCALING THE SIZE OF THE 'imageArea' MOVIE CLIP WILL AFFECT THE ORIGNAL SIZE OF WHATEVER IMAGE YOU HAVE IN YOUR IMAGES FOLDER

}

//

/* Event handlers for 'Next image' and 'Previous image' buttons.

These statements allows flash to advance or go back to the next childNode

(next image and text) in your .xml document.

 

The Property (.nextSibling;) evaluates the XML object and references the next sibling

in the parent node's child list. This method returns null if the node does not

have a next sibling node. This is a read-only property and cannot be used to

manipulate child nodes.

*/

next_btn.onRelease = function() {

nextImageNode = currentImageNode.nextSibling;

if (nextImageNode == null) {

break;

} else {

currentIndex++;

updateImage(nextImageNode);

currentImageNode = nextImageNode;

}

};

//

// Event handler for 'Previous image' button

back_btn.onRelease = function() {

previousImageNode = currentImageNode.previousSibling;

if (previousImageNode == null) {

break;

} else {

currentIndex--;

currentImageNode = previousImageNode;

updateImage(previousImageNode);

}

};

e no xml esta assim

<IMAGES>

<imageNode jpegURL="images/image1.jpg">Rapidly develop rich Internet applications with approachable, integrated tools that leverage leading web server technologies and device platforms.</imageNode>

 

 

<imageNode jpegURL="images/image2.jpg">Dreamweaver MX

Build websites and web applications.</imageNode>

 

<imageNode jpegURL="images/image3.jpg" link="images/image1.jpg">Macromedia Flash MX

Create rich Internet content and applications.</imageNode>

 

<imageNode jpegURL="images/image4.jpg">ColdFusion MX

Rapidly build and deploy Internet applications.</imageNode>

 

<imageNode jpegURL="images/image5.jpg">Fireworks MX

Design and optimize interactive web graphics.</imageNode>

 

<imageNode jpegURL="images/image6.jpg">FreeHand 10

Create vector-based illustrations for Macromedia Flash and for print.</imageNode>

 

<imageNode jpegURL="images/image7.jpg">Director 8.5 Shockwave Studio

Develop magnetic Internet destinations and powerful multimedia.</imageNode>

 

<imageNode jpegURL="images/image8.jpg">JRun 4

The fast, affordable, and reliable J2EE server.</imageNode>

 

<imageNode jpegURL="images/image9.jpg">Authorware 6.5

Create rich-media e-learning applications with a drag-and-drop visual interface.</imageNode>

 

</IMAGES>

quem puder ajudar agradeço!

Compartilhar este post


Link para o post
Compartilhar em outros sites

Para fazer isso você terá de usar o MovieClipLoader() e usar a propriedade da classe loadClip()

Ai você coloca um object listener no MovieClipLoader e quando iniciar você coloca um link na imagem...

 

Da uma olhada na galeria simples que eu criei como tuto aqui no forum mesmo que lá tem

 

Abraços

Compartilhar este post


Link para o post
Compartilhar em outros sites

eu vi, é um arquivo escrito 'galeria_picassa'?

eu vi mas pelo jeito vou ter que mexer na estrutura toda e infelizmente o tempo esta curto.

 

há um jeito de fazer semelhante ao 'lightbox'? ou então abrir como pop up?

Compartilhar este post


Link para o post
Compartilhar em outros sites

Você vai morrer no mesmo problema

 

Pois do jeito que está feito não tem como setar um botão na imagem... pois loadMovie não permite que você acesse o conteudo do clip para saber nenhuma das propriedades... logo tbm não vai conseguir setar nele um valor para usar para o popup ou lightbox =/

 

Não é muito complexo não só trocar os loadMovies por loadClip só que usando MovieClipLoader

 

Vou dar um exemplo:

 

Normalmente você carrega uma imagem assim:

loadMovie("imagem.jpg", container);

E não tem acesso a nada da imagem... nem tamanho... nem onde foi carregada... nem o nome dela... nada!

 

Com MovieClipLoader você declara apenas uma vez:

var mcl:MovieClipLoader = new MovieClipLoader()

 

Ai você faz:

mcl.loadClip("imagem.jpg", container);

 

 

Ai com isso se você colocar um objeto de listener

var listener:Object = new Object();

 

E adicionar ao MovieClipLoader

mcl.addListener(listener);

 

Você vai ter acesso aos dados da imagem ao carregar... durante o carregamento... ao iniciar...

usando

listener.onLoadComplete = function(){
  trace("Terminei de carregar");
}
listener.onLoadInit = function(){
  trace("fui iniciado");
}
listener.onLoadProcess = function(){
	trace("estou carregando");
}

 

Então no final o código deve ficar assim:

var mcl:MovieClipLoader = new MovieClipLoader();
var imagem:MovieClip = _root.createEmptyMovieClip("imagem", _root.getNextHighestDepth());
var listener:Object = new Object();
mcl.addListener(listener);

var url:String = "http://www.d2stations.com/";
var foto:String = "NarutoC.JPG";

mcl.loadClip(url+foto, imagem);

listener.onLoadProgress = function(imagem:MovieClip){
	var total:Number = imagem.getBytesTotal();
	var loaded:Number = imagem.getBytesLoaded();
	trace("bytesLoaded: " + loaded + " bytesTotal: " + total);
}
listener.onLoadComplete = function(imagem:MovieClip){
	trace("carreguei o arquivo completamente");
}
listener.onLoadInit = function(imagem:MovieClip){
	if(imagem._width > Stage.width or imagem._height > Stage.height){
		imagem._xscale = imagem._yscale = ((Stage.width)*(100))/imagem._width;
	}
	trace("iniciei reduzi a escala da imagem");
}
listener.onLoadError = function(){
	trace("Erro ao carregar o arquivo");
}
listener.onLoadStart = function(){
	trace("iniciei o carregamento da foto "+foto);
}

Se quiser copiar e colar o código acima para ver o que acontece sinta-se a vontade ele funciona :)

 

Abraços ;)

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.