RE: [flexcoders] Cairngorm 2 - Event propagation problem
Have you inlcuded the front controller tag in your login.mxml? You should have a line in login.mxml that looks something like... Without this line your program would still compile, but there wouldn't be a front controller to "hear" the cairngorm events. Other than that your code looks fine. Darren >From: "hemantkamatgi" <[EMAIL PROTECTED]> >Reply-To: flexcoders@yahoogroups.com >To: flexcoders@yahoogroups.com >Subject: [flexcoders] Cairngorm 2 - Event propagation problem >Date: Thu, 17 Aug 2006 05:20:25 - > >Hi, > >I am trying to use Cairngorm 2 framework with Flex 2. >This issue is that the event (login) does not seem to reach the >FrontController. >I am listing my application files with the significant code snippets: >I have been struggling with this for the past 2 days but aint seem to >figure out the problem. > >1) ApplicationFrontController.as > >// addCommand("login", LoginCommand); > >2) LoginCommand.as //implements Command > >//public function execute(event:CairngormEvent):void > >3) LoginEvent.as //extends CairngormEvent > > //public function LoginEvent() > //{ > //super("login"); > //} > >4) Login.mxml > >// public function doLogin():void >// { var eventObject : LoginEvent = new LoginEvent(); >// CairngormEventDispatcher.getInstance().dispatchEvent(new LoginEvent()); >// } -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
Re: [flexcoders] Cairngorm 2 - Event propagation problem
Hi hemantkamatgi, just a few things I recognized: 1. When dispatching the Cairngorm event, you shouldn't create two instances of the LoginEvent here... just one and pass it! > // { var eventObject : LoginEvent = new LoginEvent(); > // CairngormEventDispatcher.getInstance().dispatchEvent(new LoginEvent()); 2. I assume, you LoginVO is only missing in your post, not in your code..!? The section above best looks like this (including the VO): var loginVO : LoginVO = new LoginVO(); loginVO.xx = xx; /* add any values you need */ var eventObject : LoginEvent = new LoginEvent(loginVO); CairngormEventDispatcher.getInstance().dispatchEvent(eventObject); 3. In your front controller you add the event using a string "login". Same for the LoginEvent itself. You should create a constant variable in the controller to minimise the chances of errors. Now, this is just some sommon stuff, don't know if this solves your problem, though... Cheers, Thomas hemantkamatgi wrote: > > > Hi, > > I am trying to use Cairngorm 2 framework with Flex 2. > This issue is that the event (login) does not seem to reach the > FrontController. > I am listing my application files with the significant code snippets: > I have been struggling with this for the past 2 days but aint seem to > figure out the problem. > > 1) ApplicationFrontController.as > > // addCommand("login", LoginCommand); > > 2) LoginCommand.as //implements Command > > //public function execute(event:CairngormEvent):void > > 3) LoginEvent.as //extends CairngormEvent > > //public function LoginEvent() > //{ > //super("login"); > //} > > 4) Login.mxml > > // public function doLogin():void > // { var eventObject : LoginEvent = new LoginEvent(); > // CairngormEventDispatcher.getInstance().dispatchEvent(new LoginEvent()); > // } > > -- Thomas Rühl Design, Programming & Concepts akitogo OHG Hanauer Landstrasse 188 60314 Frankfurt Telefon +49 (0) 69 800 69 445 Fax +49 (0) 69 800 69 449 Mobil +49 (0) 179 750 75 87 E-Mail [EMAIL PROTECTED] Web http://www.akitogo.com -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
[flexcoders] Cairngorm 2 - Event propagation problem
Hi, I am trying to use Cairngorm 2 framework with Flex 2. This issue is that the event (login) does not seem to reach the FrontController. I am listing my application files with the significant code snippets: I have been struggling with this for the past 2 days but aint seem to figure out the problem. 1) ApplicationFrontController.as // addCommand("login", LoginCommand); 2) LoginCommand.as //implements Command //public function execute(event:CairngormEvent):void 3) LoginEvent.as //extends CairngormEvent //public function LoginEvent() //{ //super("login"); //} 4) Login.mxml // public function doLogin():void // {var eventObject : LoginEvent = new LoginEvent(); // CairngormEventDispatcher.getInstance().dispatchEvent(new LoginEvent()); // } -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/