Instance Level Variables and Methods are independent for each instance of the class : Variable scope : Data Type Flash / Flex / ActionScript examples


Flash / Flex / ActionScript examples » Data Type » Variable scope »

 

Instance Level Variables and Methods are independent for each instance of the class


 

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

        var myTest:ScopeTest = new ScopeTest();
        trace(myTest.answer//Displays: 42

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

      public var answer:Number = 42;
}

        



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


Flash / Flex / ActionScript examples

 Navioo Data Type
» Variable scope