I added some debugging info to see which part of the process is time consuming. I found that the query execution is just taking 20 sec. However converting the data (~12000 records) to Array and then setting that as a dataProvider to the DataGrid is taking ~2 mins.
Is there a better way to create a dataProvider for DataGrid other then converting it to Array??
Just a thought: you may want to delay the call to the database to give your popup a chance to display before the system locks down while the SQL call and array population logic happens.
You could do this with callLater() or even using a timer. Just give the player a chance to show your popup before the other code starts.
I do this in my app when parsing a large bit of data. Unfortunately, since we don't have threads we can't show some kind of animated dialog or a progress bar. But you could fake this as well by doing your parsing in chunks and allowing the player to update the display, including the dialog window and some kind of animated progress bar.
Also, you might investigate greenthreads (http://code.google.com/p/greenthreads/). Haven't used it but seems interesting...
Thanks for your reply.
The popup logic is actually placed before I execute my SQL queries. However I will try to add a little delay for the popup to apear. Another thing that I have noticed is that the screen dont get freezed, rather the entire screen becomes white the way application just hangs out.
So even if the popup gets displayed, its never gonna appear. I'll check the other link which you had provided and will get back if I find anything.