Waiting until a URL is cached

Trevor DeVore lists at mangomultimedia.com
Fri Jun 4 13:05:13 EDT 2004


On Jun 4, 2004, at 10:42 AM, Devin Asay wrote:

> What is the best way to delay an action until a requested URL has been 
> fully downloaded?
>
> I have tried ...
>
> load URL myURL
> repeat until the URLStatus of myURL is "cached"
>   set the cursor to busy
> end repeat
> -- do other stuff
>
>  load URL line lineClicked of the imageFiles of me
>   repeat until myURL is among the lines of the cachedURLs then
>     set the cursor to busy
>   end if
>   -- do other stuff
>
> -- (I even tried this one even though the docs specifically advise 
> against it.*)
> load URL myURL
> wait until the URLStatus of myURL is "cached"
> -- do other stuff
>
> All of these approaches entered an infinite loop or hung stage, which 
> I had to Cmd-. to interrupt. Oddly enough, when I then checked the 
> cachedURLs function, all of the URLs I had loaded in the above 
> examples were there.
>
> Am I just doing this wrong?

Use the callback message:

load [URL] url [with message callbackMessage]

The message will be called when everything is done downloading and you 
can use the downloaded file however you need to at that point.

-- 
Trevor DeVore
Blue Mango Multimedia
trevor at mangomultimedia.com



More information about the use-livecode mailing list