Loading files freezes app

While pulling images down from the internet to be saved locally and used in the app, there should be a loader bar, or something able to indicate the progress. The problem is that while the loop is happening, everything freezes. Due to the frozen state, nothing appears or can happen at all that takes place in the Lua code until all the images are completely loaded.

I have tried numerous methods of iterating though the 12 images, but have had no luck attempting to make the files appear one at a time (sequentially). How can I do this so there isn’t just one long period of absolutely no activity?

The loop that loads images:

[code]
for z=1,12,1 do

print(“Loading picture #” … z)

– Create local file for saving data
local path = system.pathForFile( “picture-” … z … “.png”, system.DocumentsDirectory )

myFiles[z] = io.open( path, “r” )

if myFiles[z] then
– Do not re-write
else
myFiles[z] = io.open( path, “w+” )
http.request{
url = “https://example.com/”… data[z].id …"/?type=large",
sink = ltn12.sink.file(myFiles[z]),
}

end

profile_blocks[z] = display.newImage(“picture-” … z … “.png”,system.DocumentsDirectory,20,20)

print(“Loaded picture #” … z)
end
[/code] [import]uid: 21125 topic_id: 6374 reply_id: 306374[/import]

Trying ASYNC http request instead. [import]uid: 21125 topic_id: 6374 reply_id: 22050[/import]

there is no progress bar on iDevices. There is a wait status which is the spinning circle of death.

Try that.

Obviously, in the api it is not called system.displaySpinningCircleofDeath.

C [import]uid: 24 topic_id: 6374 reply_id: 24818[/import]