Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/actionscript-3/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Actionscript 3 &&;actionscript中的操作_Actionscript 3 - Fatal编程技术网

Actionscript 3 &&;actionscript中的操作

Actionscript 3 &&;actionscript中的操作,actionscript-3,Actionscript 3,在下面的代码中,即使“BITMAP”为null,if语句后的行也会运行。为什么会这样 public function get BitmapHeight () { if (_bitmapHeight == 0 && BITMAP != null) _bitmapHeight = BITMAP.bitmapData.height; return _bitmapHeight; } 如果位图为空,则不应运行该行

在下面的代码中,即使“BITMAP”为null,if语句后的行也会运行。为什么会这样

public function get BitmapHeight ()
      {
        if (_bitmapHeight == 0 && BITMAP != null)
          _bitmapHeight = BITMAP.bitmapData.height;
        return _bitmapHeight;
      }

如果位图为空,则不应运行该行代码

试试这个:

public function get BitmapHeight (){
    if (_bitmapHeight == 0 && BITMAP != null){
        trace("called with null");
        _bitmapHeight = BITMAP.bitmapData.height;
    }
    return _bitmapHeight;
}

“使用null调用”是否被跟踪?

如果位图为null,则不应运行该行代码

试试这个:

public function get BitmapHeight (){
    if (_bitmapHeight == 0 && BITMAP != null){
        trace("called with null");
        _bitmapHeight = BITMAP.bitmapData.height;
    }
    return _bitmapHeight;
}

“用null调用”是否被跟踪过?

我在这里做了一个很长的尝试,但由于您没有跟踪,我认为您有可能通过使用调试器进入该行来判断是否正在执行编码后的行


如果是这种情况,那么您看到的源代码可能与实际编译到swf中的代码不完全相同。例如,如果在开始调试后删除该文件中的一行(可能是空行),则swf中保存的行号将与您看到的源代码文件中的行号不匹配。这种情况偶尔会发生在我身上,给我一个WTF的时刻。。。直到我意识到我又做了一次,所以我才重新启动调试会话。

我在这里做了一个很长的尝试,但由于您没有跟踪,我认为您有可能通过使用调试器进入该行来判断是否正在执行编译后的行


如果是这种情况,那么您看到的源代码可能与实际编译到swf中的代码不完全相同。例如,如果在开始调试后删除该文件中的一行(可能是空行),则swf中保存的行号将与您看到的源代码文件中的行号不匹配。这种情况偶尔会发生在我身上,给我一个WTF的时刻。。。直到我意识到我又做了一次,所以我才重新启动调试会话。

如果位图为null,则无法调用该行。调用时跟踪(位图)。另外,如果位图为空,则不能调用该行,可以说“if(_bitmapHeight==0&&BITMAP)”。调用时跟踪(位图)。也可以说“如果(\u bitmapHeight==0&&BITMAP)”