Well, it’s a bit complicated.
I first build an array of all the entries in the list of birds that comes with the version of the app.
Then I have to merge this list with the local data that the user may have changed.
Then I have to sort/filter the list acccording to the settings of the user.
Then I build the GUI from this data.
There quite some loops going on… It’s not trivial to use the model that you sketched without a major rewrite of the loading code. I was just playing around to see if I could use the frameRedrawListener() to something. Turns out it’s difficult.
I’m trying to add the call addEventLister(“enterFrame”, frameRedrawListener) before anything else, if that is what you mean.
My (simplified) frame function looks like this:
local FrameNum = 0 local frameRedrawListener = function(e) FrameNum = FrameNum + 1 print(FrameNum) end print("Calling addEventListener") Runtime:addEventListener( "enterFrame", frameRedrawListener ) print("Called addEventListener")
This results in a log looking more or less like this:
Calling addEventListener Called addEventListener isTablet = true preloadBirdImageData() - start 1 / 196 2 / 196 ... 195 / 196 196 / 196 guiBuildList() - frames used = 0 preloadBirdImageData() - end shouldUpdateBirdList is TRUE Composite sort string: ORDER BY name ASC db:nrows(SELECT \* FROM birdTable ORDER BY name ASC ) scene:show:will guiBuildList() - start guiBuildList() - frames used = 0 guiBuildList() - end 1 2 3
The addEventListener is clearly called before the “heavy stuff” starts. Still frameRedrawListenerer() seems only to be “active” after everything else is done.