1 Reply Latest reply on Oct 15, 2009 1:48 PM by FlexNewbie999

    Getter/setter methods and class variables

    FlexNewbie999

      I'm trying to create a simple AS class. Given I have a class-level variable called - 'firstName' declared as:

      private var firstName:String = "";

       

      I'd like to have setter/getter methods defined as:

       

          public function set firstName(firstName:String):void {
                  firstName = firstName;
              }
             
             
              public function get firstName():String
              {
                  return firstName;
              }

       

      At the declaration of 'firstName' I get the following error:

      1013: The private attribute may ony be used on class property definitions.

       

      I'm coming from Java and using the FlexBuilder 3 plug-in

       

      What am I missing?