Changing this made MouseTest run:
- public static var renderer:IRenderer = new BaseRenderer;
+ private static var _renderer:IRenderer;
+ public static function get renderer():IRenderer
+ {
+ if(!_renderer)
+ _renderer = new BaseRenderer;
+ return _renderer;
+ }
+ public static function set renderer(value:IRenderer):void{
+ _renderer = value;
+ }
I don’t know well enough to know whether getters and setters are necessary. If
leaving the var uninitialized and requiring it to be set by the client might be
a more efficient solution.
> On Sep 5, 2017, at 8:27 PM, Harbs <[email protected]> wrote:
>
> 0.8 was more capable of using constants of non-native types, but it had much
> more difficulty with resolving circulars.
>
> Static constants and non-lazy static vars should be used with only native
> types. For non-native types you should use lazy initialization.
>
> It’s a trade-off that I’ve found is very work-able.
>
>> On Sep 5, 2017, at 1:03 PM, lizhi <[email protected]> wrote:
>>
>> Thank you very much!
>> Well, I also know there's a setTimeout, but this setTimeout is only JS
>> built, so I don't care.
>> However, it seems that the new version of the flexjs compiler has problems
>> dealing with static classes. And flexjs0.8 doesn't have that problem.
>>
>>
>>
>> -----
>> spriteflexjs.com
>> --
>> Sent from: http://apache-flex-development.2333347.n4.nabble.com/
>