查看: 933|回复: 2
|
How to reset?
[复制链接]
|
|
I've make an automatic picture viewer using flash to view a series of picture by using 'setInterval' and with the count up number after the file name. But the problem is how do I exit the loop and repeat the number?
For example, if I only want to view 30 pictures, how to make the 'count' back to 1 after 30?
The code is as below. Thanks.
setInterval(
function(){
photo.loadMovie(folder.text + "\/" + "picture" + " " + "(" + count + ")" + ".jpg")
,count++}
, 250);
[ 本帖最后由 dunecherng 于 9-2-2006 12:34 PM 编辑 ] |
|
|
|
|
|
|
|
发表于 10-2-2006 05:44 AM
|
显示全部楼层
//載入圖片函數
loadImage = function(){
photo.loadMovie(folder.text + "\/" + "picture" + " " + "(" + count + ")" + ".jpg");
count = (count > 30) ? count = 1 : count++; //大於30就回到1,否則繼續遞增
}
var image = setInterval(loadImage,250); //設定每250毫秒執行載入圖片函數
clearInterval(image); //停止interval的循環
[ 本帖最后由 super-tomato 于 10-2-2006 05:45 AM 编辑 ] |
|
|
|
|
|
|
|
发表于 12-2-2006 02:32 AM
|
显示全部楼层
原帖由 dunecherng 于 9-2-2006 09:12 AM 发表
I've make an automatic picture viewer using flash to view a series of picture by using 'setInterval' and with the count up number after the file name. But the problem is how do I exit the loop and ...
樓主這裡是華語論壇請多用中文發表
謝謝合作。 |
|
|
|
|
|
|
| |
本周最热论坛帖子
|