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?

有帮助吗?

解决方案

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.

其他提示

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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top