It is possible with static getter and seter.

Maybe will help you the code below 

Spiros.

public class Variable
        {
                
                private static var _textData:String;

                public static function get textData():String
                {
                        if( _textData ==null)
                        {
                                initailizeVariable();
                        }
                        return _textData;
                }

                public static function set textData(value:String):void
                {
                        _textData = value;
                }
                
                public static function initailizeVariable():void
                {
                        _textData = "The quick brown fox jump over the lazy 
dog.";
                }
                
                
                public function Variable()
                {
                }
        }
   




-----Original Message-----
From: Carlos Rovira [mailto:[email protected]] 
Sent: Wednesday, June 26, 2019 5:49 PM
To: [email protected]
Subject: Trying to run a function on a class that is not instantiated

Hi,

I need to run a function when I access a public static var in a class.
Trying to run the function in the constructor seems not to work since
there's no instance of that class. Do we have some way to do this?

-- 
Carlos Rovira
http://about.me/carlosrovira

Reply via email to