Strange flex module behavior.Module become null when add a little nonsense code

28 views Asked by At

When code like this

moduleInfo.addEventListener(ModuleEvent.READY,function(e:ModuleEvent):void{
    var module:Object=moduleInfo.factory.create();
    var elem:IVisualElement=module as IVisualElement;
    isModuleLoaded=true;
});

We can see the var module and elem are not null.

check debug result

But when we add a little nonsense code

moduleInfo.addEventListener(ModuleEvent.READY,function(e:ModuleEvent):void{
    var module:Object=moduleInfo.factory.create();
    var elem:IVisualElement=module as IVisualElement;
    if (elem is IGuipModule){
    }
    isModuleLoaded=true;
});

the var module and elem become null.

check debug result

So,what's wrong???

0

There are 0 answers