Re: [flexcoders] Caurngorm 2 - where to deal with system events?

2006-04-24 Thread JesterXL



I've been using Cairngorm in Flex 1.5, haven't used C2 in Flex 2 yet, thanks 
for the link!

In that case, yep, have to do what Alex suggested.

As far as maintainable code, you can extend a Cairngorm Event class (or you 
own), and attach a callback function to it. Your Command classes can then 
call this function when they are done. This will allow the View who 
dispatched the command to know when it's done, and immediately call another 
one, etc.

- Original Message - 
From: Andrea Varga [EMAIL PROTECTED]
To: flexcoders@yahoogroups.com
Sent: Sunday, April 23, 2006 1:35 PM
Subject: Re: [flexcoders] Caurngorm 2 - where to deal with system events?


I have read that using EventBroadcaster is deprecated in Cairngorm 2,
instead the built in dispatchEvent() should be used:
http://weblogs.macromedia.com/swebster/archives/2006/02/index.cfm

OT - My messages appear with several hours delay on the list. Does
anyone know why?

Andi

JesterXL wrote:

You don't need that if you are using Cairngorm's EventBroadcaster; it has
nothing to do with DisplayObjects. Simply do what Alex suggested in the
result of your Command, do:

EventBroadcaster.getInstance().broadcastEvent ( Event.YOUR_EVENT, {param:
value});

- Original Message - 
From: Alex Uhlmann [EMAIL PROTECTED]
To: flexcoders@yahoogroups.com
Sent: Sunday, April 23, 2006 12:03 PM
Subject: RE: [flexcoders] Caurngorm 2 - where to deal with system events?


Hi Andi,

You can certainly call another Command in the onResult of your
LoginCommand. But since a Command class in not on the display list,
events wouldn't make it to Cairngorm's FrontController. You have to use
mx.core.Application.application.dispatchEvent. Darron Schall has a nice
explanation of it here:
http://www.darronschall.com/weblog/archives/000224.cfm

Best,
Alex

Alex Uhlmann
Consultant (Rich Internet Applications)
Adobe Consulting
Westpoint, 4 Redheughs Rigg, South Gyle, Edinburgh, EH12 9DQ, UK
p: +44 (0) 131 338 6969
m: +44 (0) 7917 428 951
[EMAIL PROTECTED]


-Original Message-
From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Andrea Varga
Sent: 23 April 2006 11:15
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Caurngorm 2 - where to deal with system events?

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
Yahoo! Groups Links








--
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







--
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










--
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












--
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



  Visit your group "flexcoders" on the web.
  To unsubscribe from this group, send an email to:[EMAIL PROTECTED]
  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



  











[flexcoders] Caurngorm 2 - where to deal with system events?

2006-04-23 Thread Andrea Varga



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



  Visit your group "flexcoders" on the web.
  To unsubscribe from this group, send an email to:[EMAIL PROTECTED]
  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



  











RE: [flexcoders] Caurngorm 2 - where to deal with system events?

2006-04-23 Thread Alex Uhlmann



Hi Andi,

You can certainly call another Command in the onResult of your
LoginCommand. But since a Command class in not on the display list,
events wouldn't make it to Cairngorm's FrontController. You have to use
mx.core.Application.application.dispatchEvent. Darron Schall has a nice
explanation of it here:
http://www.darronschall.com/weblog/archives/000224.cfm

Best,
Alex

Alex Uhlmann
Consultant (Rich Internet Applications)
Adobe Consulting
Westpoint, 4 Redheughs Rigg, South Gyle, Edinburgh, EH12 9DQ, UK
p: +44 (0) 131 338 6969
m: +44 (0) 7917 428 951 
[EMAIL PROTECTED] 


-Original Message-
From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Andrea Varga
Sent: 23 April 2006 11:15
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Caurngorm 2 - where to deal with system events?

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
Yahoo! Groups Links



 








--
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



  Visit your group "flexcoders" on the web.
  To unsubscribe from this group, send an email to:[EMAIL PROTECTED]
  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



  












Re: [flexcoders] Caurngorm 2 - where to deal with system events?

2006-04-23 Thread JesterXL



You don't need that if you are using Cairngorm's EventBroadcaster; it has 
nothing to do with DisplayObjects. Simply do what Alex suggested in the 
result of your Command, do:

EventBroadcaster.getInstance().broadcastEvent ( Event.YOUR_EVENT, {param: 
value});

- Original Message - 
From: Alex Uhlmann [EMAIL PROTECTED]
To: flexcoders@yahoogroups.com
Sent: Sunday, April 23, 2006 12:03 PM
Subject: RE: [flexcoders] Caurngorm 2 - where to deal with system events?


Hi Andi,

You can certainly call another Command in the onResult of your
LoginCommand. But since a Command class in not on the display list,
events wouldn't make it to Cairngorm's FrontController. You have to use
mx.core.Application.application.dispatchEvent. Darron Schall has a nice
explanation of it here:
http://www.darronschall.com/weblog/archives/000224.cfm

Best,
Alex

Alex Uhlmann
Consultant (Rich Internet Applications)
Adobe Consulting
Westpoint, 4 Redheughs Rigg, South Gyle, Edinburgh, EH12 9DQ, UK
p: +44 (0) 131 338 6969
m: +44 (0) 7917 428 951
[EMAIL PROTECTED]


-Original Message-
From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Andrea Varga
Sent: 23 April 2006 11:15
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Caurngorm 2 - where to deal with system events?

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
Yahoo! Groups Links








--
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











--
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



  Visit your group "flexcoders" on the web.
  To unsubscribe from this group, send an email to:[EMAIL PROTECTED]
  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



  











Re: [flexcoders] Caurngorm 2 - where to deal with system events?

2006-04-23 Thread Andrea Varga



I have read that using EventBroadcaster is deprecated in Cairngorm 2, 
instead the built in dispatchEvent() should be used:
http://weblogs.macromedia.com/swebster/archives/2006/02/index.cfm

OT - My messages appear with several hours delay on the list. Does 
anyone know why?

Andi

JesterXL wrote:

You don't need that if you are using Cairngorm's EventBroadcaster; it has 
nothing to do with DisplayObjects. Simply do what Alex suggested in the 
result of your Command, do:

EventBroadcaster.getInstance().broadcastEvent ( Event.YOUR_EVENT, {param: 
value});

- Original Message - 
From: Alex Uhlmann [EMAIL PROTECTED]
To: flexcoders@yahoogroups.com
Sent: Sunday, April 23, 2006 12:03 PM
Subject: RE: [flexcoders] Caurngorm 2 - where to deal with system events?


Hi Andi,

You can certainly call another Command in the onResult of your
LoginCommand. But since a Command class in not on the display list,
events wouldn't make it to Cairngorm's FrontController. You have to use
mx.core.Application.application.dispatchEvent. Darron Schall has a nice
explanation of it here:
http://www.darronschall.com/weblog/archives/000224.cfm

Best,
Alex

Alex Uhlmann
Consultant (Rich Internet Applications)
Adobe Consulting
Westpoint, 4 Redheughs Rigg, South Gyle, Edinburgh, EH12 9DQ, UK
p: +44 (0) 131 338 6969
m: +44 (0) 7917 428 951
[EMAIL PROTECTED]


-Original Message-
From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Andrea Varga
Sent: 23 April 2006 11:15
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Caurngorm 2 - where to deal with system events?

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
Yahoo! Groups Links








--
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







--
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



 

 








--
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



  Visit your group "flexcoders" on the web.
  To unsubscribe from this group, send an email to:[EMAIL PROTECTED]
  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.