ActionScript阶段浏览器ZoomFactor错误

ActionScript阶段浏览器ZoomFactor错误,actionscript,flash,stage,Actionscript,Flash,Stage,使用this.stage.browserZoomFactor时,编译会 Error: Access of possibly undefined property browserZoomFactor through a reference with static type flash.display:Stage. return this.stage.browserZoomFactor; 这很不幸,因为我在网上找不到任何实际使用browserZoomFactor的例子。不确定如

使用this.stage.browserZoomFactor时,编译会

Error: Access of possibly undefined property browserZoomFactor 
through a reference with static type flash.display:Stage.

        return this.stage.browserZoomFactor;
这很不幸,因为我在网上找不到任何实际使用browserZoomFactor的例子。不确定如何着手解决此问题,但欢迎所有建议

相关代码段:

public function getZoomLevelInfo():Number {
        return this.stage.browserZoomFactor;
    }

除非您使用IE、Windows 8,否则此功能将无法工作。其他浏览器不报告浏览器缩放量,因此将找不到该属性。

您似乎在静态引用中使用了此选项。 在调用其属性之前,请确保stage不为null。 如果定义了stage,那么stage.browserZoomFactor应该可以正常工作

请尝试以下代码:

if ( stage === null ) trace("stage is null, it's a scope issue");
else trace("zoom factor:", stage.browserZoomFactor);