PureMVC Architects Lounge

PureMVC Manifold => MultiCore Version => Topic started by: davidTikva on January 09, 2011, 11:01:52



Title: Why null ?
Post by: davidTikva on January 09, 2011, 11:01:52
Hello,
I moved from standard to multiCore, and of course, it's pretty much the same
and as for my problem, I don't think it's matter:

I'm creating a facade in this way:

public function MyFacade(key:String)
{
   super(key);
}

this is the getInstance function:
public static function getInstance(key:String) : MyFacade
{
      if(instanceMap[key] == null) instanceMap[key] = new MyFacade(key);
         
   return MyFacade(instanceMap[key]);
}

this is the initializeController function:
override protected function initializeController():void
{
         registerCommand( ShellConsts.STARTUP, StartupCommand );
}

I get on this function this error:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
   at org.puremvc.as3.multicore.patterns.facade::Facade/registerCommand()

why is that?  :o

thanks in advanced


Title: Re: Why null ?
Post by: puremvc on January 12, 2011, 11:13:25
You need to call super.initializeController() first. Here's what's not happening when you fail to do that in MultiCore:

:
       protected function initializeController( ):void {
            if ( controller != null ) return;
            controller = Controller.getInstance( multitonKey );
        }
-=Cliff>