开发者

ActionScript Math.abs() Conditional Not Working

i have a number variable, vx, that is changing with an enter frame event. in the enter frame fu开发者_C百科nction i have the following code:

if  (Math.abs(vx) <= 0.05);
    {
    trace(Math.abs(vx));
    }

immediately, it's starts outputting numbers that are well above 0.05:

12.544444075226783
12.418999634474515
12.29480963812977
12.171861541748472
12.050142926330986
11.929641497067676
11.810345082097
11.69224163127603
11.575319214963269
11.459566022813636
11.3449703625855
11.231520658959644
11.119205452370048
11.008013397846348
10.897933263867884
10.788953931229205
10.681064391916912
10.574253747997743
10.468511210517764
10.363826098412586
10.260187837428461
10.157585959054176
10.056010099463634
9.955449998468998
9.855895498484308

does this make sense to anyone?


You have an extra colon ';' after your if.

if (Math.abs(vx) <= 0.05);<--

Without i think it will works better:

if  (Math.abs(vx) <= 0.05) {
 trace(Math.abs(vx));
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜