Jump to content
Fórum Script Brasil
  • 0

Ajuda Com Slideshow Script!


Guest S3nd41
 Share

Question

Guest S3nd41

aí pessoal, estou usando este pedaço de código para fazer load de um slideshow de imagens de um ficheiro xml e estava pensando como poderia mudar isto para quando você carregar no next button na última imagem ela fazer loop para a primeira, e também fazer loop da primeira para a última, de forma a visualizar as imagens sequencialmente.

Será que me podem ajudar? Aqui vai o código:

images_xml = new XML();

images_xml.onLoad = startImageViewer;

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

images_xml.ignoreWhite = true;

//

this.onEnterFrame = function() {

filesize = targetClip.getBytesTotal();

loaded = targetClip.getBytesLoaded();

preloader._visible = true;

if (loaded != filesize) {

preloader.preload_bar._xscale = 100*loaded/filesize;

} else {

preloader._visible = false;

if (targetClip._alpha<100) {

targetClip._alpha += 10;

}

}

};

//

function setButtons() {

if (p == 0) {

back_btn._visible = 0;

} else if (p == total-1) {

next_btn._visible = 0;

} else {

next_btn._visible = previous_btn._visible=1;

}

}

//

function startImageViewer(success) {

if (success == true) {

rootNode = images_xml.firstChild;

totalImages = rootNode.childNodes.length;

firstImageNode = rootNode.firstChild;

currentImageNode = firstImageNode;

currentIndex = 1;

updateImage(firstImageNode);

}

}

function updateImage(newImageNode) {

imagePath = newImageNode.attributes.imgURL;

imageText = newImageNode.firstChild.nodeValue;

targetClip.loadMovie(imagePath);

imageCount = currentIndex + "/" + totalImages;

}

next_btn.onRelease = function() {

//setButtons();

nextImageNode = currentImageNode.nextSibling;

if (nextImageNode == null) {

break;

} else {

currentIndex++;

if (loaded == filesize) {

targetClip._alpha = 0;

}

updateImage(nextImageNode);

currentImageNode = nextImageNode;

}

};

back_btn.onRelease = function() {

//setButtons();

previousImageNode = currentImageNode.previousSibling;

if (previousImageNode == null) {

break;

} else {

currentIndex--;

targetClip._alpha = 0;

currentImageNode = previousImageNode;

updateImage(previousImageNode);

}

};

stop();

Obrigadão pela ajuda!

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Forum Statistics

    • Total Topics
      149.8k
    • Total Posts
      646.6k
×
×
  • Create New...