查看: 1077|回复: 2
|
slide show
[复制链接]
|
|
我有一个slide show,如何写得under user control? 开始时,会自动跳动
delay = 3000;
function loadXML(loaded) {
if (loaded) {
xmlNode = this.firstChild;
image = [];
id = [];
description = [];
total = xmlNode.childNodes.length;
for (i=0; i<total; i++) {
image[ i ] = xmlNode.childNodes[ i ].childNodes[0].firstChild.nodeValue;
id[ i ] = xmlNode.childNodes[ i ].childNodes[4].firstChild.nodeValue;
description[ i ] = xmlNode.childNodes[ i ].childNodes[7].firstChild.nodeValue;
}
firstImage();
} else {
c;
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("images.xml");
p = 0;
this.onEnterFrame = function() {
filesize = picture.getBytesTotal();
loaded = picture.getBytesLoaded();
preloader._visible = true;
if (loaded != filesize) {
preloader.preload_bar._xscale = 100*loaded/filesize;
} else {
preloader._visible = false;
if (picture._alpha<100) {
picture._alpha += 10;
}
}
};
function nextImage() {
if (p<(total-1)) {
p++;
if (loaded == filesize) {
picture._alpha = 0;
picture.loadMovie(image[p], 1);
desc_txt.text = description[p];
picture_num();
slideshow();
}
}
}
function prevImage() {
if (p>0) {
p--;
picture._alpha = 0;
picture.loadMovie(image[p], 1);
desc_txt.text = description[p];
picture_num();
}
}
function firstImage() {
if (loaded == filesize) {
picture._alpha = 0;
picture.loadMovie(image[0], 1);
desc_txt.text = description[0];
picture_num();
slideshow();
}
}
function picture_num() {
current_pos = p+1;
pos_txt.text = current_pos+" / "+total;
}
function slideshow() {
myInterval = setInterval(pause_slideshow, delay);
function pause_slideshow() {
clearInterval(myInterval);
if (p == (total-1)) {
p = 0;
firstImage();
} else {
nextImage();
}
}
}
//当click stop,按钮会变成'play',movie就停
//control movie
control.onPress = function(){
resetCtr();
myCtr[0] = true;
control.gotoAndStop(2);//变成‘play'
}
myCtr = 2;
resetCtr();
function resetCtr() {
for (j=0;j<myCtr;j++) {
myAct[j] = false;
}
control.gotoAndStop(1);//变成‘stop’
}
//按了,就变成上一页
slide_back.onPress = function(){
if (p>0) {
p--;
picture._alpha = 0;
picture.loadMovie(image[p], 1);
desc_txt.text = description[p];
picture_num();
}
}
//按了,就变成下一页 (如何停slide show?按了,它跳去下一页,但还继续slide show)
slide_next.onPress = function(){
if (p<(total-1)) {
p++;
if (loaded == filesize) {
picture._alpha = 0;
picture.loadMovie(image[p], 1);
desc_txt.text = description[p];
picture_num();
}
}
}
[ 本帖最后由 xiao_yee 于 23-3-2007 06:11 PM 编辑 ] |
|
|
|
|
|
|
|
发表于 24-3-2007 12:27 AM
|
显示全部楼层
没有触发不可能会继续走,除非电脑闹鬼。
我很早以前就理解一样事情,电脑没有奇迹,只有人为程序。
你尝试用trace去解决一下再看怎样。 |
|
|
|
|
|
|
|

楼主 |
发表于 25-3-2007 11:25 AM
|
显示全部楼层
我在研究看看
那至于 我的按钮(movie clip制成),按了,play frame 2,再按, play frame 1.它只会play frame 2,不会回 frame 1. 我这里,有那点是错了?
//control movie
control.onPress = function(){
resetCtr();
myCtr[0] = true;
control.gotoAndStop(2);//变成‘play'
}
myCtr = 2;
resetCtr();
function resetCtr() {
for (j=0;j<myCtr;j++) {
myAct[j] = false;
}
control.gotoAndStop(1);//变成‘stop’
} |
|
|
|
|
|
|
| |
本周最热论坛帖子
|