Add assignment code to class constructor : Constructor « Class « Flash / Flex / ActionScript






Add assignment code to class constructor

 

package com.java2s {
  internal class MyClass {
    internal var varName = "Unnamed";

    public function MyClass (name) {
      this.varName = name;
    }
  }
}

        








Related examples in the same category

1.Creating a Constructor
2.Add public attribute to contrustor.
3.A class named Product with a constructor and a method
4.Constructor with parameter
5.Set the memeber variable in constructor
6.Declare a constructor method for the Example class