-
Displaying an image for a set time using actionscript
Hello all,
If i have the following code:
Code:
next_btn.onRelease = function() {
nextImageNode = currentImageNode.nextSibling;
if (nextImageNode == null) {
break;
} else {
currentIndex++;
updateImage(nextImageNode);
currentImageNode = nextImageNode;
}
};
this checks to see if "nextImageNode" has a "nextSibling" (an image) when the "next_btn" is clicked.
If null then it stops else it goes to the next image by updating to nextImageNode. It then gives "currentImageNode" the value of the current image.
At least I think that's correct?
Knowing all that what i want to do is add another button (aut_start) that when clicked displays the current image (currentImageNode) for 20 seconds then goes to the next image (nextImageNode) and displays that for 20 seconds and so on till it gets to the end of the image slide show.
Can anyone give me some advice on how to achieve this?
Cheers,
Suzy
-
You could most probably use setInterval to create a 20 seconds pause between each picture being displayed.
-
Thanks for the reply oldnewbie.
Neally there...I think
This is what I have so far:
Code:
auto_start.onRelease = function() {
nextImageNode = currentImageNode.nextSibling;
if (nextImageNode == null) {
break;
} else {
displayTime = 20;
countDown = function (message) { displayTime--;if (displayTime == 0) {clearInterval(timer);currentIndex++;updateImage(nextImageNode);currentImageNode = nextImageNode;}};
timer = setInterval(countDown, 1000);
}
};
This works fine, except it only allows me to do it once.
What function or code do i need to add to the above code to make it loop through the above process until it gets to the end (nextImageNode == null)?
Regards,
Suzy
-
Senior Member
Try this:
auto_start.onRelease = function() {
nextImageNode = currentImageNode.nextSibling;
if (nextImageNode != null) {
displayTime = 20;
countDown = function (message) {
displayTime--;
if (displayTime == 0) {
currentIndex++;
updateImage(n
extImageNode);currentImageNode = nextImageNode;
if (nextImageNode == null) {
break;
clearInterval(timer);
}
}
};
timer = setInterval(countDown, 1000);
}
};
- The right of the People to create Flash movies shall not be infringed. -
-
Wow! We're on a roll this morning! Aren't we!
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
|