Well, I load around 37~ files in a scene, I load them through a loop, problem is I wanted to make a progressView to indicate how much time left to finish loading, but the app freezes while loading these files so the progressView doesn’t move until it finishes loading the files, how to make it not freeze or if there is any other solutions…
Can you please post some code regarding your problem? Thanks!
You may need to break up the loading into segments using a timer or coroutines (if you want to be super efficient).
I suggest something simple though:
-- Code to create and start busy indicator here local filesLoaded = 1 local maxFiles = 37 local loadNextFile loadNextFile = function() --- Code to load one file here. Be sure to load the right one based on filesLoaded counter filesLoaded = filesLoaded + 1 if( filesLoaded \> maxFiles ) then -- Code to stop and destroy busy indicator here return end timer.performWithDelay(1,loadNextFile) end loadNextFile()
When you write a loop like:
for i = 1, 1000000000 do
– do stuff
end
That loop is going to finish before the next frame buffer update. @roaminggamer is right. Use a co-routine or timers to break your load into parts to give Corona a chance to update the screen.
See: https://coronalabs.com/blog/2015/02/10/tutorial-using-coroutines-in-corona/
Rob
Yes the timer did work, but I realized that I didn’t even need to make a loading progressView, lol it was just about that the screen doesn’t update inside the loop so I had to wait for its next frame but with the timer I do not have to, Thanks guys 
Can you please post some code regarding your problem? Thanks!
You may need to break up the loading into segments using a timer or coroutines (if you want to be super efficient).
I suggest something simple though:
-- Code to create and start busy indicator here local filesLoaded = 1 local maxFiles = 37 local loadNextFile loadNextFile = function() --- Code to load one file here. Be sure to load the right one based on filesLoaded counter filesLoaded = filesLoaded + 1 if( filesLoaded \> maxFiles ) then -- Code to stop and destroy busy indicator here return end timer.performWithDelay(1,loadNextFile) end loadNextFile()
When you write a loop like:
for i = 1, 1000000000 do
– do stuff
end
That loop is going to finish before the next frame buffer update. @roaminggamer is right. Use a co-routine or timers to break your load into parts to give Corona a chance to update the screen.
See: https://coronalabs.com/blog/2015/02/10/tutorial-using-coroutines-in-corona/
Rob
Yes the timer did work, but I realized that I didn’t even need to make a loading progressView, lol it was just about that the screen doesn’t update inside the loop so I had to wait for its next frame but with the timer I do not have to, Thanks guys 