Need help with XML Photo gallery/Slideshow
Dear forumers,
I need help with creating a automatic slideshow with control buttons.
Have browsed through Kirupa's tutorials and have made references to the following 2 tutorials
http://www.kirupa.com/developer/mx2004/xml_flash_photogallery.htm
http://www.kirupa.com/developer/mx2004/xml_slideshow.htm
I am trying to combine the codes for these 2 tutorials so that I can have the images cycle automatically but at the same time with control buttons
like "back", "next" and "pause".
Please see below for my attempt..
stop();
delay = 3000;
function loadXML(loaded) {
if (loaded) {
xmlNode = this.firstChild;
image = ;
image2 = ;
image3 = ;
description = ;
total = xmlNode.childNodes.length;
for (i=0; i
image[i] = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue;
image2[i] = xmlNode.childNodes[i].childNodes[1].firstChild.nodeValue;
image3[i] = xmlNode.childNodes[i].childNodes[2].firstChild.nodeValue;
description[i] = xmlNode.childNodes[i].childNodes[3].firstChild.nodeValue;
}
firstImage();
} else {
content = "file not loaded!";
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("images.xml");
/////////////////////////////////////
Key.addListener(listen);
listen = new Object();
listen.onKeyDown = function() {
if (Key.getCode() == Key.LEFT) {
prevImage();
} else if (Key.getCode() == Key.RIGHT) {
nextImage();
}
};
Key.addListener(listen);
previous_btn.onRelease = function() {
prevImage();
};
next_btn.onRelease = function() {
nextImage();
};
/////////////////////////////////////
//------------ preloader
p = 0;
this.onEnterFrame = function() {
filesize = picture.getBytesTotal();
loaded = picture.getBytesLoaded();
filesize = picture2.getBytesTotal();
loaded = picture2.getBytesLoaded();
filesize = picture3.getBytesTotal();
loaded = picture3.getBytesLoaded();
preloader._visible = true;
if (loaded != filesize) {
preloader.preload_bar._xscale = 100*loaded/filesize;
preloader2.preload_bar._xscale = 100*loaded/filesize;
preloader3.preload_bar._xscale = 100*loaded/filesize;
} else {
preloader._visible = false;
if (picture._alpha<100) { ActionScript 1.0/2.0 [Archive] - Page 143 - kirupaForum:: need help on finishing these tweens using Fuse. kirupa gallery I really need some help Flash/XML menu problem. scroll zoom, dynamic txt. flip with depth http://www.kirupa.com/forum/archive/index.php/f-9-p-143.htmlHOME |
picture._alpha += 10;
}
preloader2._visible = false;
if (picture2._alpha<100) {
picture2._alpha += 10;
}
preloader3._visible = false;
if (picture3._alpha<100) {
picture3._alpha += 10;
}
}
};
//------------ preloader
function nextImage() {
if (p<(total-1)) {
p++;
if (loaded == filesize) {
picture._alpha = 0;
picture.loadMovie(image[p], 1);
picture2._alpha = 0;
picture2.loadMovie(image2[p], 1);
picture3._alpha = 0;
picture3.loadMovie(image3[p], 1);
desc_txt.text = description[p];
picture_num();
slideshow();
}
}
}
function prevImage() {
if (p>0) {
p--;
picture._alpha = 0;
picture.loadMovie(image[p], 1);
picture2.loadMovie(image2[p], 1);
picture3.loadMovie(image3[p], 1);
desc_txt.text = description[p];
//picture_num();
}
}
function firstImage() {
if (loaded == filesize) {
picture._alpha = 0;
picture.loadMovie(image[0], 1);
picture2.loadMovie(image2[0], 1);
picture3.loadMovie(image3[0], 1);
desc_txt.text = description[0];
//picture_num();
slideshow();
}
}
/*
function picture_num() {
current_pos = p+1;
pos_txt.text = current_pos+" / "+total;
}
*/
//-- timer thing
function slideshow() {
myInterval = setInterval(pause_slideshow, delay);
function pause_slideshow() {
clearInterval(myInterval);
if (p == (total-1)) {
p = 0;
firstImage();
} else {
nextImage();
}
}
//function
}
Issue 1
------------
I tried to assign the functions nextImage(); and prevImage(); into my 'next' and 'back' buttons respectively
The automated slideshow works fine but there seems to be a bug somewhere whereby 'next' brings me to the next screen but
right after that the other screens will jump about in wrong sequences.
I have no wonder what is wrong as i am a beginner in AS.
------------
Issue 2
------------
I require a 'pause' button in my slideshow as well
Is anyone kind enough to help me write a function that I can assign to my 'pause' button to make the slideshow pause?
I see a pause_slideshow() within the slideshow() function but I do not really understand the codes, that is why I am having so much
difficulty.
Please help me! Thanks in advance :hugegrin:
Someone help me please.. i need this rather urgently..:azn:
Checking
Please refer rhamej XMl Gallery in kirupa
Thanks everyone!
I have managed to find a solution to my problem
Have made reference to an earlier thread :)
http://www.kirupa.com/forum/showthread.php?t=92555
:mario:
Please refer rhamej XMl Gallery in kirupa
Hi thanks for your reply. I have tried searching for rhamej XML Gallery in kirupa but to no avail. Is it possible for me to give me the exact link? your help will be very much appreciated. Will appreciate more experts' help too :afro:
Where's The Advantage In Windows Genuine Advantage?
Stocks Bounce After S&P Joins Bear Market
|