Hello everybody,
I am getting some errors when I register a mediator for my Application's child.
I have a method in my ApplicationFacade called
startup() which I call withing the creationComplete event handler of my
Application.mxml. This method sends a notification
STARTUP, which is registered with a Command called
StartupCommand in which I register a mediator called
ApplicationMediator.
Now in my
Application.mxml I have a view component called
DisplayView, which contains a ViewStack with two other view components,
LoginView And
MainView. The viewstack selectedindex is by default set to 0 and creationPolicy set to auto.
Well, I created a mediator for
DisplayView view component called
DisplayViewMediator which I am registering on the
onRegister() method of my
ApplicationMediator.
After I did all this, my app won't run, it throws me errors referencing the line where I am registering the DisplayViewMediator.
I'll paste the error here:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at org.puremvc.as3.core::View/registerMediator()[C:\Documents and Settings\Owner.CapricornOne\My Documents\My Workspaces\PureMVC\PureMVC_AS3\src\org\puremvc\as3\core\View.as:189]
at org.puremvc.as3.patterns.facade::Facade/registerMediator()[C:\Documents and Settings\Owner.CapricornOne\My Documents\My Workspaces\PureMVC\PureMVC_AS3\src\org\puremvc\as3\patterns\facade\Facade.as:337]
at view::ApplicationMediator/onRegister()[C:\Users\Renato\Work\flex\tnekvoip_admin\source\src\cl\tnek\voipadmin\view\ApplicationMediator.as:18]
at org.puremvc.as3.core::View/registerMediator()[C:\Documents and Settings\Owner.CapricornOne\My Documents\My Workspaces\PureMVC\PureMVC_AS3\src\org\puremvc\as3\core\View.as:201]
at org.puremvc.as3.patterns.facade::Facade/registerMediator()[C:\Documents and Settings\Owner.CapricornOne\My Documents\My Workspaces\PureMVC\PureMVC_AS3\src\org\puremvc\as3\patterns\facade\Facade.as:337]
at controller::StartupCommand/execute()[C:\Users\Renato\Work\flex\tnekvoip_admin\source\src\cl\tnek\voipadmin\controller\StartupCommand.as:12]
at org.puremvc.as3.core::Controller/executeCommand()[C:\Documents and Settings\Owner.CapricornOne\My Documents\My Workspaces\PureMVC\PureMVC_AS3\src\org\puremvc\as3\core\Controller.as:115]
at Function/http://adobe.com/AS3/2006/builtin::apply()
at org.puremvc.as3.patterns.observer::Observer/notifyObserver()[C:\Documents and Settings\Owner.CapricornOne\My Documents\My Workspaces\PureMVC\PureMVC_AS3\src\org\puremvc\as3\patterns\observer\Observer.as:100]
at org.puremvc.as3.core::View/notifyObservers()[C:\Documents and Settings\Owner.CapricornOne\My Documents\My Workspaces\PureMVC\PureMVC_AS3\src\org\puremvc\as3\core\View.as:126]
at org.puremvc.as3.patterns.facade::Facade/notifyObservers()[C:\Documents and Settings\Owner.CapricornOne\My Documents\My Workspaces\PureMVC\PureMVC_AS3\src\org\puremvc\as3\patterns\facade\Facade.as:404]
at org.puremvc.as3.patterns.facade::Facade/sendNotification()[C:\Documents and Settings\Owner.CapricornOne\My Documents\My Workspaces\PureMVC\PureMVC_AS3\src\org\puremvc\as3\patterns\facade\Facade.as:387]
at ApplicationFacade/startup()[C:\Users\Renato\Work\flex\tnekvoip_admin\source\src\cl\tnek\voipadmin\ApplicationFacade.as:34]
at Application/___Application_WindowedApplication1_creationComplete()[C:\Users\Renato\Work\flex\tnekvoip_admin\source\src\cl\tnek\voipadmin\Application.mxml:9]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at mx.core::UIComponent/dispatchEvent()[E:\dev\beta1\frameworks\projects\framework\src\mx\core\UIComponent.as:11260]
at mx.core::UIComponent/set initialized()[E:\dev\beta1\frameworks\projects\framework\src\mx\core\UIComponent.as:1513]
at mx.managers::LayoutManager/validateClient()[E:\dev\beta1\frameworks\projects\framework\src\mx\managers\LayoutManager.as:988]
at mx.core::UIComponent/validateNow()[E:\dev\beta1\frameworks\projects\framework\src\mx\core\UIComponent.as:6881]
at spark.components::WindowedApplication/window_resizeHandler()[E:\dev\beta1\frameworks\projects\airframework\src\spark\components\WindowedApplication.as:2609]
at flash.display::NativeWindow/set _menu()
at flash.display::NativeWindow/set menu()
at spark.components::WindowedApplication/commitProperties()[E:\dev\beta1\frameworks\projects\airframework\src\spark\components\WindowedApplication.as:1681]
at mx.core::UIComponent/validateProperties()[E:\dev\beta1\frameworks\projects\framework\src\mx\core\UIComponent.as:7019]
at mx.managers::LayoutManager/validateProperties()[E:\dev\beta1\frameworks\projects\framework\src\mx\managers\LayoutManager.as:572]
at mx.managers::LayoutManager/doPhasedInstantiation()[E:\dev\beta1\frameworks\projects\framework\src\mx\managers\LayoutManager.as:700]
at mx.managers::LayoutManager/doPhasedInstantiationCallback()[E:\dev\beta1\frameworks\projects\framework\src\mx\managers\LayoutManager.as:1067]
I uploaded the source files zipped so you can give me a hand with this. I really don't understand what is going on here. I checked if the reference to the viewComponent passed into the mediator constructor is null by tracing it, and it is not null, it is not, it prints this:
Application0.WindowedApplicationSkin2.Group3.Group4.DisplayView6
Thanks in advance.
Edit: If I comment out the line that registers the DisplayViewMediator, the applications works.
The link to the source files are here:
http://www.tnek.cl/source.zip