flash相册代码出错!!高手帮下

来源:百度知道 编辑:UC知道 时间:2024/05/22 15:13:51
老师布置了一个作业,其中需要做一个相册,要求镜框中图片由清晰到模糊的淡入效果,老师给的代码如下:
var currentlmg=1;
var max=5;
var fadeSpeed=6;
_root.image1._alpha=20;
_root.image1.onEnterFrame=function(){
if(this._alpha<100-fadeSpeed){
this._alpha+=fadeSpeed;
}else{ this._alpha=100; }}
_root.nextlmg.onPress=function()
{ currentlmg++;
if(currentlmg>max){ currentlmg%=max; }
gotoAndStop(currentlmg);}
_root.prevlmg.onPress=function(){
currentlmg--;
if(currentlmg<1){currentlmg=max;}
gotoAndStop(currentlmg);}stop();
完成后总提示最后一行有错,图片不停变。我在stop前加个分号,图片不动了,按钮也没用了!
急急急!高手快帮下!感激不尽……
在线等……
stop();
换行也没用

在stop(); 前 按一下回车

换一下行嘛 真是服了 这样的代码格式 看着头痛 编译器更加不知所言

经过我的测试,找到了问题的结症:
只需要在stop前边打个回车即可!
哈哈,没想到问题竟然在这。
.....................................................
黑龙江省巴彦县兴隆镇中心校 张志晨
................以诚待友..........守信为人..........
以下是我修正后的:
var currentlmg = 1;
var max = 5;
var fadeSpeed = 6;
_root.image1._alpha = 20;

_root.image1.onEnterFrame = function() {
if (this._alpha<100-fadeSpeed) {
this._alpha += fadeSpeed;
} else {
this._alpha = 100;
}
};

_root.nextlmg.onPress = function() {
currentlmg++;
if (currentlmg>max) {
currentlmg %= max;
}
gotoAndStop(currentlmg);
};

_root.prevlmg.onPress = function() {
currentlmg--;
if (currentlmg<1) {
currentlmg = max;
}
gotoAndStop(currentlmg);
};
stop();