0

我需要将“速度”的变量值作为一个整数出现,这样它就可以影响我的“BG”电影剪辑的滑动位置。使用此代码(并尝试许多其他变体)后,“round”变量仅作为 0 或 1 出现。(此代码都在ENTER FRAME函数中。)

var speed:Number = (xspeed + yspeed) / 100;
var round:Number = Math.round(speed);

BG.gotoAndStop(speed);
texta.text = ""+(round);
4

1 回答 1

1

Well, you're diving by 100 so there's a high likelyhood that your number is actually between 0 and 1 (if xspeed + yspeed is ever less than 100, speed will be less than 1 after dividing by 100).

What do you get when you trace(speed)?

于 2013-04-29T09:25:33.980 回答