Hi All!

I have to mention that I'm new to Cairngorm and Flex.
What is best practice to deal with system events (or whatever the events
that are not dispatched by a user gesture are called)?
For example: after a successful user login I have to display a list of
products (list loded from the server).
So, I have a login form in a component: Login.mxml, where I have a
dispatch for the LoginEvent =>  the LoginCommand takes care of it...
(goes to server etc.), the onResult method in the LoginCommand is
called. If the login was successful, I set the
ModelLocator.applicationState to the new state, the view is binded to
that, so now I have the correct view (with a datagrid for example), and
now I need the list of the products.
But for that, I need the list of the products =  the
ProductListGetCommand must be executed which means, that somebody has to
dispatch an event for that, but there is no user gesture here.
Where should I place the code for dispathing the event?
Or, is my whole logic correct?

My only idea here is to place it in LoginCommand.onResult?

I have tried that:
var tmpEvent:ProductListGetEvent = new ProductListGetEvent();
dispatchEvent( tmpEvent );
I got the error: Call to a possibly undefined method 'dispatchEvent'

That's why I think this might not be the right place.


I'm using Cairngorm 2.0 Flex 2.0 and AMFPHP , but I think this is not
reallt relevant here.

Thanks
Andi




--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com




SPONSORED LINKS
Web site design development Computer software development Software design and development
Macromedia flex Software development best practice


YAHOO! GROUPS LINKS




Reply via email to