Question

Imagine a parent.swf that loads a child.swf via flash.display.Loader and both contain the same class:

package com.company {
   public class MyClass {
      public static var x:int;
   }
}

Will these two classes share the static variable x or will each movieclip have their own?

Was it helpful?

Solution

Actually I made a small test to just check the behaviour and it seems that the movieclips do not share the same static variable. Each of them has their own even though exactly the same class has been used during compile time.

OTHER TIPS

There should only be one class ... you can use use the MXMLC compiler for example to exclude the class from the child swf, which has a dependency to the parent. Then you could avoid such troubles. The trouble I am speaking of is having a newer SWF containing a modified version of MyClass. This would lead to a naming collision.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top