Hi there,

The other day I was thinking how to access local variables in more than one function in the same class. As example, we take a custom class called "Fields". My point is that I don't want to create another instance of the Fields class, but I do want to access the field variable in another function. Let me create an example of it:


Actionscript Code:
package
    {
        import flash.display.Sprite;
       
       
        /**
         * ...
       
         */

        public class Main extends Sprite
        {

       

          public function Main()
          {
           
                     createFields();
          }

          private function createFields():void
          {
                     
            var field:Fields = new Fields();
            addChild(field);
                       
          }
         
          private function accesFieldHere():void
          {
              var field:Fields = Fields();
              field.someProperty = "bla";
          }

           
        }

This doesn't work. But i'm trying to achieve it that way. Can someone explain me why this isn't working? Or should I forget this and make the variable global? I hope I'm clarified myself enough.