Welcome, Guest. Please login or register.
Did you miss your activation email?
31 Jul 2010, 11:38:27 UTC
Forum home
+  flexdeveloper.eu Forum
|-+  Flex and ActionScript 3.0
| |-+  Best Practice, OOP & MVC Frameworks (Moderators: flexy, Jan K, James)
| | |-+  Loading reference data at startup in an asynchronous world.
« previous next »
Pages: [1] Print
Author Topic: Loading reference data at startup in an asynchronous world. (Read 3446 times)
phuego
Newbie FD
*
Posts: 3


« on: 01 May 2008, 16:31:57 UTC »

Hi all

looking for your Flex app design advice.

This app has lots of combo box with list of reference data sourced from database.
These lists are dynamic, its OK to cache them during session but cannot hard code into Flex.
Think, list of client name / client id.

I use HTTPService to call server side and get XML back, no problem, and can load the  lists on the HTTPservice result except it is asynchronous. I need to load the lists (there are many) *before* the user has opportunity to use the UI which contains them.
In a synchronous world, say a JSP, this is easy - thread just blocks until the db call ends, user looks at a blank browser until we render the page post db call return.

But in a Flex client, where the HTTPservice call is asynch, and the UI won't wait for the calls to arrive before doing anything else.... how to do this?

I started thinking - kick off the HTTPService calls to get the combo box data in the Application's initialise() event... load the combo boxes when the data arrives, hope the delay isnt too long.  But this feels wrong. I don't want my user to "see" the combo box data arrive, and i don't want them to click on the combo box and see it "empty" neither.

Another idea I had was for the app to put up a big "loading" canvas, and only drop it when the HTTPService calls have come back... but this reminds me of the splash screen concept of 1995 a bit too much. "Show them a pretty graphic while we get sorted back here"...

I toyed with the concept of preventing the UI screen from entering "creationComplete" stage but that feels bad and i don't know how to do it... and some messy custom event idea but..

Does anyone have any other ideas what is a "good" way to get around this issue?
How would you design this?
Have the combo boxes load at some point after the user sees them?
hide the UI until all reference data has loaded?
or - is there a better way?

thanks in advance for your thoughts and for reading this far. If the above doesn't make sense please post queries and i will try to clarify. But i am thinking this is a standard thing you've all cracked long ago.


Logged
flexy
flexdeveloper.eu
Guru/Addict FD
*****
Posts: 3,155


Recovering Coffee Addict & Adobe Expert


WWW
« Reply #1 on: 02 May 2008, 11:05:02 UTC »

You've encountered one of the great things about the Flash platform; allowing the user to still interact with the application, whilst asynchronously sending and receiving data behind the scenes. The most successful applications achieve this without the user really noticing, but this isn't to say that the user never sees a 'loading' message.

The way you've described your application, it seems the data holds it all together. You can't call your services until your Flex app has initialised, so your decision is whether to: leave a load of empty controls on the stage; hide them from view; extend them to have 'loading' states (or just at a loading entry to it's dataProvider); or put an application-wide loading message.

My gut feeling on this would be to only disable the controls that are initialising, particularly if the user is still able to interact with other controls on the screen, and there is benefit in them being able to do this. If the user cannot really do anything useful until those controls have been populated, my advice would be to put up a loading screen, as a load of empty controls being populated one after the other could get confusing, and lead to a diminshed user experience.
Logged

JMWhittaker
Principal FD
****
Posts: 228

Adobe Community Expert


WWW
« Reply #2 on: 02 May 2008, 12:37:54 UTC »

Agree with Flexy. You can create a custom preloader that could not only load the Flex framework and main app but then have another loading stage that loads your default data payload. Obviously it depends, as Flexy writes, if you want to allow any other interaction while this is going on.
Logged
Pages: [1] Print
« previous next »
Share this on: Twitter Twitter Del.icio.us del.icio.us Digg Digg
Jump to:

©2006-2010 Flexdeveloper.eu/Jodie O'Rourke. All rights reserved.
Adobe®, Adobe® Flash™, Adobe® AIR™ and Adobe® Flex™ are registered trademarks of Adobe Systems Incorporated in the United States and other countries. All rights reserved.

Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC