Just curious, what kind of heavy data are you loading? Huge images? Are you processing data files or doing FTP/HTTP transactions? In general, how long does your loading sequence take?
I believe that Lua works through a function sequentially, line by line, completing one thing before doing the next. So if you load 20 huge images in a function, you could set a boolean flag variable and “listen” for it to be true while you load your images. At the end of your loading sequence, set it to “true”… this should then tell the listener that everything is loaded.
For example…
local isGameLoaded = false
local function listenForGameLoaded( event )
if ( isGameLoaded == true ) then
Runtime:removeEventListener( "enterFrame", listenForGameLoaded ) --remove listener
--clear "loading" image and proceed
end
end
local function loadingSequence()
Runtime:addEventListener( "enterFrame", listenForGameLoaded )
--load big images, do FTP, etc.
isGameLoaded = true
end
--start loading sequence
loadingSequence()
You’ll have to test this… I can’t confirm it will work properly, but it’s worth a shot.
Maybe somebody else has a tested and proven solution.
Brent Sorrentino
Ignis Design
[import]uid: 9747 topic_id: 22487 reply_id: 89662[/import]