Siloky refresh a text

I want to refresh a text during a process.

The process display only the first and the last text.

I checked the console, it displays “start upload file 1” and “start upload file 2”

Any help is welcome.

This is the code

function scene:enterScene( event ) ... teStatus = display.newText( "ready", display.contentWidth\*0.5, 0, native.systemFontBold, 18) ... teStatus.text = "start upload file 1" print "start upload file 1" ... teStatus.text = "start upload file 2" print "start upload file 2" ... teStatus.text = "Finished" end

Hi @tff,

Can you specify what your goal is? This function will display a text object on the screen, and update it to “Finished”. The other .text changes will not be seen, because the display and the object is only updated to the last .text you set, since it’s all in the same code block.

Best regards,

Brent

The goal is to display 5 steps during a process.

I understand that it’s not the good method. How can i display all the steps one by one during my process in the same code block ?

Maybe, i could use something else than a newText ?

Corona updates the display every “frame”.  That is if your app is set to 30 frames per second, it will update the display ever 1/30th of a second.  This is an eternity in computer time.  Corona will likely update the text above so fast that you will only see the last response.

Our network operations are asynchronous.  That means when you call network.request(), network.download() or network.upload() they return immediately and the processing happens in the background.  A function is called when the process is complete.  If you want to upload file 1 then when it’s complete, upload the 2nd file, then you would have to start the upload of the 2nd file in a function that you write that gets called when upload 1 ends.  

Rob

Rob,

I use the FTP Helper http://developer.coronalabs.com/code/ftp-helper

teStatus = display.newText( "Ready", display.contentWidth\*0.5, 0, native.systemFontBold, 18) function fnOK ( event ) ... connection = ftp.newConnection{... local onDownloadSuccess = function(event) print("File downloaded to " .. event.path) teStatus.text = "File downloaded to : " .. event.path end connection:download{ remoteFile = "myfile1.csv", localFile = "myfile1.csv", onSuccess = onDownloadSuccess, onError = onError } connection:download{ remoteFile = "myfile2.csv", localFile = "myfile2.csv", onSuccess = onDownloadSuccess, onError = onError }

The download works fine.
It takes several seconds between each download.

The print “File downloaded to” works fine but the “teStatus.text…”

I tried somethings like display a picture, hide a button, used a progress bar…

Everything work only at the end of the download

I don’t know how can i do.

Hi @tff,

Can you specify what your goal is? This function will display a text object on the screen, and update it to “Finished”. The other .text changes will not be seen, because the display and the object is only updated to the last .text you set, since it’s all in the same code block.

Best regards,

Brent

The goal is to display 5 steps during a process.

I understand that it’s not the good method. How can i display all the steps one by one during my process in the same code block ?

Maybe, i could use something else than a newText ?

Corona updates the display every “frame”.  That is if your app is set to 30 frames per second, it will update the display ever 1/30th of a second.  This is an eternity in computer time.  Corona will likely update the text above so fast that you will only see the last response.

Our network operations are asynchronous.  That means when you call network.request(), network.download() or network.upload() they return immediately and the processing happens in the background.  A function is called when the process is complete.  If you want to upload file 1 then when it’s complete, upload the 2nd file, then you would have to start the upload of the 2nd file in a function that you write that gets called when upload 1 ends.  

Rob

Rob,

I use the FTP Helper http://developer.coronalabs.com/code/ftp-helper

teStatus = display.newText( "Ready", display.contentWidth\*0.5, 0, native.systemFontBold, 18) function fnOK ( event ) ... connection = ftp.newConnection{... local onDownloadSuccess = function(event) print("File downloaded to " .. event.path) teStatus.text = "File downloaded to : " .. event.path end connection:download{ remoteFile = "myfile1.csv", localFile = "myfile1.csv", onSuccess = onDownloadSuccess, onError = onError } connection:download{ remoteFile = "myfile2.csv", localFile = "myfile2.csv", onSuccess = onDownloadSuccess, onError = onError }

The download works fine.
It takes several seconds between each download.

The print “File downloaded to” works fine but the “teStatus.text…”

I tried somethings like display a picture, hide a button, used a progress bar…

Everything work only at the end of the download

I don’t know how can i do.