views:

143

answers:

1

I have an actionscript class with a static member variable defined.

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

When I try to access it from different parts in my code I don't get the same value in each spot.

A.x 

I am accessing the variable in different modules that are loaded, so they are all in their own separate .swf file. Could this by why?

+3  A: 

Seems like an application domain problem. The main swf and the modules seem to be accessing their own copies of the A class. You should probably change the way you load your modules.

Check this out:

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

Juan Pablo Califano