0

我有一个定义了静态成员变量的 actionscript 类。

public class A
{
     public static var x:int;
}

当我尝试从代码中的不同部分访问它时,我在每个位置都没有得到相同的值。

A.x 

我在加载的不同模块中访问变量,所以它们都在自己单独的 .swf 文件中。这可能是为什么?

4

1 回答 1

4

似乎是应用程序域问题。主 swf 和模块似乎正在访问它们自己的 A 类副本。您可能应该更改加载模块的方式。

看一下这个:

http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/system/LoaderContext.html#applicationDomain http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/system/ApplicationDomain.html

于 2010-04-05T13:42:48.033 回答