0
votes

I'm new to AS 3.0 - I have a class file with public static variables with ​​declared values . I need to know when I change any value of the variables in the main class file (.as), there is some routine (event) to do the SWF update these values in dynamic textField (on stage) without re-export the SWF.?

Thanks for any answer!

1

1 Answers

0
votes

Instead of static variables use static getters and setters. For example:

package  {

    public class MyClass {

        private static var _property:Number;

        public static function set property(value:Number):void {
            _property = value;
            // update your text field's value here
        }
        public static function get property():Number {
            return _property;
        }

    }

}

The code could be used like that:

MyClass.property = 10;
trace(MyClass.property);

it will print 10.