-
next btn
Hi
I am new to xml.
I have a gallery which loads images text etc from an xml file. I use a next btn to run through the images but when it gets to the last image it stops any ideas on how to get it to go back to the beginning.
This is an extract from the AS I am using.
Code:
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();
};
function nextImage() {
if (p<(total-1)) {
p++;
if (loaded == filesize) {
picture._alpha = 0;
picture.loadMovie(image[p], 1);
thm1.loadMovie(thumb1[p], 1);
logo_txt.text = logo[0];
caption_txt.text = caption[0];
email_txt.text = email[0];
menu_txt.text = menu[0];
next_txt.text = next[0];
}
}
}
Regards Barry
-
Senior Member
Basically you need to add an else statement to the if statement:
if (p<(total-1)) {
My guess you would then set p = 0, and then run the if (loaded ==... code block.
Thanks
Luke
-
Thanks Tupps that put me in the right direction.
-
Hi Tupps
I thought it worked but it only works on local machine when I upload to server it stops working - very strange any ideas.
Barry
-
Senior Member
Probably security, are you loading the xml file from the same server as your local file? It is usually best to reference the eg load("myFile.xml") rather than specify the entire path. A final note that when you load the flash file in a web page, the references are from the web page's location not from the swf file. So if you have the files in different directories you need to put the xml file with the html file not with the swf file.
Thanks
Luke
-
Hi Tupps
Thanks for all your help at last it works. The problem was I had moved the site within dreamweaver prior to uploading and dreamweaver had altered the links.
Regards Barry
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|