Waiting for download to complete

Peter Bogdanoff bogdanoff at me.com
Tue Nov 15 12:58:49 EST 2011


Does anyone have any suggestions as to how modify this script--cause LC to wait until the Load is completed before the script moves on to other handlers?

On Nov 14, 2011, at 05:41 PM, Peter Bogdanoff <bogdanoff at me.com> wrote:

HI,

I'm using the following script to download a file. After the download I move on to other things, How do I force LiveCode to wait until the download is completed before doing anything else besides updating a progress bar?

Currently the program moves on to other handlers that are contingent on the download being finished, which it isn't.

Thanks!

Peter


on downloadFile
   open stack "MITA_Updater"
   
   repeat until the lockscreen is "false"
      unlock screen
   end repeat
   
   updateStatus "Downloading the update..."
   
   load URL "http://artsinteractive.org/updates/MITA-1NEW.livecode" with message "downloadDone"
   
   libURLSetStatusCallback "myProgress",the long ID of scrollbar "Progress"
end downloadFile

on myProgress theObject,theStatus
   put theStatus into theObject
end myProgress

on downloadDone pUrl, pStatus
   put theURL & "MITA-1NEW.livecode" into thisURL
   
    if pStatus = "cached" then
          put url pUrl into url ("binfile:" & thisURL)
     end if
     unload url pUrl
end downloadDone
_______________________________________________
use-livecode mailing list
use-livecode at lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode



More information about the use-livecode mailing list