Westside
|
|
« on: December 29, 2008, 03:22:22 » |
|
Hi,
How can I cache the results of a query. I am generating a list of states (Alabama, Alaska, Arkansas, etc, etc) for various combo boxes in my application. I want to get a list of the states once on startup, but have a way for the views that need the combobox to all look at once location for the data provider.
How and where would I do this? As of now I have this, but it doesn't cache the results which is what I'd like
---- StatesCommand.as
var geographyProxy:GeographyProxy = facade.retrieveProxy( GeographyProxy.NAME ) as GeographyProxy; geographyProxy.getStates();
GeographyProxy.as
public function getStates():void { remoteDelegate.getStates(); }
public function result( event:Object ):void { switch ( event.token.message.operation ) { case "getStates": var ac_result:ArrayCollection = event.result as ArrayCollection; var obj:Object = new Object(); obj.state_code = ''; obj.state_name = 'Choose a State'; ac_result.addItemAt(obj, 0); sendNotification( STATES_LOADED, ac_result ); break; ----
I am unsure how I can cache this as well as is this even the right way to setup my command and my proxy. It also leads to a more frustrating problem that when this notification "STATES_LOADED" is distributed, some of the view components that need to hear it are not created yet which results in me having to make another db call for the same data when one of the other views doesn't exist.
Hope my post makes sense.
-Westside
|