1

如何在 AS3 中为(例如)屏幕宽度的值设置范围?我的意思是我有这段代码:

var myBounds:Rectangle=this.getBounds(stage);
if ((myBounds.width>650)&&(visibleArea.intersects(myBounds)))
{

  if(this.currentFrame==1)
     this.play();
}
else
{
    this.gotoAndStop(1);
}
return;

我的电影只有在宽度超过 650 像素时才会开始。我不知道如何设置一个值范围,例如:250<.width<650,所以我的电影只有在这个数字之间的宽度时才会开始。

4

1 回答 1

1
if (stage.loaderInfo.width < 650 && stage.loaderInfo.width > 250) {
    play();
} else {
    gotoAndStop(1);
}

您必须以某种间隔调用该函数,无论是按事件还是按 Enterframe。

于 2013-03-28T15:40:44.183 回答