O'Reilly logo

Essential ActionScript 3.0 by Colin Moock

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Static Method Scope

Code placed in a static method body resides in that method's scope. To demonstrate:

package {
  public class SomeClass {
    public static function staticMeth () {
      // Code here is in the staticMeth scope
    }
  }
}

Via the scope chain, code in a static method's scope can access these definitions:

  • All definitions available to code in the global scope

  • All definitions available to code in the scope of the class containing the static method definition

Additionally, code in a static method's scope can access the following definition:

  • All local variables, nested functions, and namespaces defined within the static method

In other words:

package {
  public class SomeClass extends SomeParentClass {
    public static function staticMeth () {
      // Local variables, nested functions, and namespaces defined here
      // are accessible throughout staticMeth
    }
  }
}

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required