Class Level (Static) Variables and Methods are accessed by using the class name followed by the object name : Variable scope « Data Type « Flash / Flex / ActionScript






Class Level (Static) Variables and Methods are accessed by using the class name followed by the object name

 

package{
  import flash.display.Sprite;
  
  public class Main extends Sprite{
    public function Main(){

        trace(ScopeTest.foo); // Displays: bar

    }
  }
}
 class ScopeTest {
      public static var foo:String = "bar";
   }

        








Related examples in the same category

1.Static Method Scope
2.Instance Method Scope
3.ActionScript available scopes:
4.Instance Level Variables and Methods are independent for each instance of the class
5.Function-Level Variables and Functions