AS代码看不懂,请大侠帮忙解释一下

来源:百度知道 编辑:UC知道 时间:2024/07/05 06:14:39
stop();
iIsFoled = 1;

onEnterFrame = function()
{
if(_ymouse >= thumbboard._y)
iIsFoled = 0;
else
iIsFoled = 1;
if(iIsFoled == 1)
{
if(484 - thumbboard._y > 1)
thumbboard._y = thumbboard._y + (484 - thumbboard._y)/2;
if(thumbboard._alpha > 0)
thumbboard._alpha -= (thumbboard._alpha)/2;
}
if(iIsFoled == 0)
{
if(thumbboard._y - 373 > 1)
thumbboard._y = thumbboard._y - (thumbboard._y - 373)/2;
if(thumbboard._alpha < 100)
thumbboard._alpha += (100 - thumbboard._alpha)/2;
}
}

...5分也太少了吧

这是一个帧的侦听函数 也就是每帧都执行
if(_ymouse >= thumbboard._y)
iIsFoled = 0;
else
iIsFoled = 1;
if(iIsFoled == 1)
{
if(484 - thumbboard._y > 1)
thumbboard._y = thumbboard._y + (484 - thumbboard._y)/2;
if(thumbboard._alpha > 0)
thumbboard._alpha -= (thumbboard._alpha)/2;
}
if(iIsFoled == 0)
{
if(thumbboard._y - 373 > 1)
thumbboard._y = thumbboard._y - (thumbboard._y - 373)/2;
if(thumbboard._alpha < 100)
thumbboard._alpha += (100 - thumbboard._alpha)/2;
}
这些

应该是一个判断的方法根据鼠标在thumbboard的上边还是下边,给IsFoled赋值0或1;

如果是1的话再判断484 - thumbboard._y > 1的值
如果成立的话执行thumbboard._y = thumbboard._y + (484 - thumbboard._y)/2;

然后再判断if(thumbboard._alpha > 0) 是否成立(thumbboard的透明度是否大于0)
成立的话执行这个
thumbboard._alpha -= (thumbboard._alpha)/2;

大概就是这个意思吧 分太少没动力