Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • Private methods (non-static as well as static ones) and private static fields are declared in new scope, shared by all class members. Thus, they are visible for every method, but not from outside. Non-static private method calls have to be rewritten to run with the correct this.
  • Private non-static fields and internal members are renamed: they are post-fixed by $ plus the inheritance level of the declaring class, so that they cannot name-clash with fields of the same name, declared in a subclass or superclass. Internal members are post-fixed by $ plus the full package name (with . replaced by _), so that they cannot The inheritance level is a number starting at 0 for Object, continuing with 1 for each direct subclass of Object, then 2 for classes inheriting from these classes, and so on. Internal members are also renamed, because they could name-clash with members of the same name, declared in a subclass or superclass residing in another package.

Static code execution

In ActionScript, a class may not only contain static members, but also static code. Static fields may also have initializers which are quite similar to static code.
Static code and static initializers are executed exactly once, let's call this "the class is initialized". A class is initialized right before code that references it is executed. Note that this has nothing to do with import directives, nor does a class trigger immediate initialization of all classes to which it has static dependencies.

...