Class instantiation in static function

Hi Everyone,

I would like to use a class method in a class static function such as the following approach:

module utils 
{
    class Temp
    {
        private var _data as Array<Float> = [0.0, 0.0, 0.0, 0.0];

        public function initialize()
        {

        }

        public function set(value as Float)
        {
            _data[1] = value;
        }

        public function data() as Array<Float>
        {
            return _data;
        }

        public static function foo(value as Float) as Array<Float>
        {
            var temp = new Temp();
            temp.set(2.0);
            return temp.data;
        }
    }
}

But the compiler complains that Temp does not have :set and :data symbols.

Anyone knows why ?

Can I avoid this issue womehow ?

Thanks in advance

Best Slight smile

Top Replies

  • But the compiler complains that Temp does not have :set and :data symbols.

    I tried your exact example code with 4.1.6 and 4.2.0 beta 1, and it compiled fine, except for the following typo…

All Replies