ensuring buttons stay responsive during intensive task

I'm using director class for my menu transitions.

If the user pushes the 'process menu button' a maths calculation is performed which takes 5 seconds or more. During that time the back button remains unresponsive. It only works again after the calculation is finished.

Is there a way for the button to remain responsive during the calculation ? It would be nice if the user could push "back" to go back to the main menu (and interrupt the calculation)

We'd have to see some code, 5 seconds is a long time, what kind of calculation is this?

Peach :)

Hi Peach!

FYI it's not a game or anything.

I'm performing a FOR DO loop through 10,000 rows of Table data, performing a complex number calc on each?

Just wondering if it's possible to listen for button events during that ?

You could have an enterFrame listener and split your 10,000 iterations into manageable chunks to be performed each frame, giving the user the opportunity to push the back button and interrupt the processing.

hmmm, Ok - I could try that.

You might be able to utilize coroutines to help you split your computation up without a major refactor of your code. Add coroutine.yield between each of your computation calls, and put a coroutine.resume in the enterFrame while you are doing this.

views:1640 update:2011/12/31 9:35:10
corona forums © 2003-2011