views:

68

answers:

1

I am currently writing a flex project which works a bit like a standard website, with categories on the left side and then the products from that category on the right hand side (and also pages for the products etc and checkout process). This is made up of seperate full page components in a viewstack which get shown when a user clicks on the relevant button.

Throughout the project i refer to these categories quite often and i have a call to the webservice on each onshow of the component and it returns the datatable to the component and i then use it as a data provider for (typically) a repeater on the component.

I am thinking that it is overkill to continuously call the webservice to get the data.

Is there a way i can call the webservice once from the main application mxml on start up and then keep the data for use by the components?

A: 

You may consider using the MVC pattern. Put the data in a Model, that is a singleton, and call the Model when you need it. The following site is worth to have a look: http://unitedmindset.com/jonbcampos/2009/08/18/flex-best-practices-models-views-and-controllers/

michael