tags:

views:

511

answers:

1

What is the best way to show a dialog or busy cursor for an AIR application that needs to do a bit of pre-processing before displaying anything? Otherwise, the user may think that the app crashed in the 15-25 seconds it takes...

+1  A: 

I can't speak speak for AIR specifically, but on all the Flash pages, apps, and widgets I've written, I always include a preloader.

Here is a good example of a preloader that actually loads external content.

But if you're just doing heavy calculations and not loading any external data:

  • Determine the total number of "units of work" that need to be completed (eg: if you have 100 rows of data to process, that's your total units of work)
  • Display an animated "Loading..." MovieClip
  • Start calculating and increment a progress count variable each time a unit of work has been completed
  • When the progress count reaches the total, hide the Loading MovieClip

If you want to display a percentage loaded, calculate the following and feed it into a TextField inside your Loading MovieClip:

percentage = (count / total) % 100
Soviut