【问题标题】:ActionScript Math.abs() Conditional Not WorkingActionScript Math.abs() 条件不工作
【发布时间】:2010-08-30 17:29:36
【问题描述】:

我有一个数字变量 vx,它随着输入帧事件而变化。在输入框架函数中,我有以下代码:

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

立即开始输出远高于 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

这对任何人都有意义吗?

【问题讨论】:

    标签: actionscript-3 math conditional absolute


    【解决方案1】:

    if 后面多了一个冒号 ';'

    if (Math.abs(vx) &lt;= 0.05);

    如果没有我认为它会更好:

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

    【讨论】:

    • 天哪,我太迟钝了。多么尴尬!谢谢你看到。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-04-29
    • 2017-06-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-03-26
    相关资源
    最近更新 更多