Futurescale, Inc. PureMVC Home

The PureMVC Framework Code at the Speed of Thought


Over 10 years of community discussion and knowledge are maintained here as a read-only archive.

New discussions should be taken up in issues on the appropriate projects at https://github.com/PureMVC

Pages: [1]
Print
Author Topic: Why null ?  (Read 7993 times)
davidTikva
Jr. Member
**
Posts: 12


View Profile Email
« 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
Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #1 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>
Logged
Pages: [1]
Print