I don’t know if there’s something “native” you can do, but here’s an approach that will work.
You can split the loading assets into groups. Each group will be loaded by calling a function.
As you know, Corona runs all the code and after that the effects are visible on the device. (So for an instruction to make an effect it’s not enough for it to finish executing, all the instructions need to finish).
Let’s assume you have to load a background, character A, B and C.
[blockcode]
local background = {}
local A = {}
local B = {}
local C = {}
local function updateProgressBar(value)
–update the progress bar using the value
end
local function loadC()
–load C
updateProgressBar(100)
–everything is loaded
end
local function loadB()
–load B
updateProgressBar(75)
timer.performWithDelay(100,loadC)
end
local function loadA()
–load A
updateProgressBar(50)
timer.performWithDelay(100,loadB)
end
local function loadBackground()
–load background
updateProgressBar(25)
timer.performWithDelay(100,loadA)
end
updateProgressBar(0)
–The delay it’s required because all the code needs to be executed before changes are visible on the device
–If you wouldn’t use a delay then the progress bar wouldn’t update until everything would be loaded
timer.performWithDelay(100,loadBackground)
[/blockcode] [import]uid: 70003 topic_id: 35578 reply_id: 141395[/import]