LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!
Hello, I'm using that flag to detect when a stack download was completed, but in Windows it always remain to "connected".
I even tried using my local Apache server or using my hosted remote site. Here the code:
on openStack
global myUrl
local myTimer, myTimerStart
put "http://127.0.0.1/stacks/fConsole.rev" into myUrl
if myURL is not among the lines of the cachedURLs then
load url myUrl with message "downloadComplete"
put 15 into myTimerStart
put 0 into myTimer
put "Looking for Console..." into field "labLoadInProgress"
repeat while ( (the urlStatus of myUrl) is not "cached") and (myTimer < myTimerStart)
put (the urlStatus of myUrl) & "..." && (myTimerStart - myTimer) into field "labLoadInProgress"
wait for 0.5 seconds
add 1 to myTimer
end repeat
else
send "downloadComplete" to this stack in 1 milliseconds
end if
end openStack
-----------------------------------------------------------------------------------------------------------
on downloadComplete
global myUrl
put "All done." into field "labLoadInProgress"
wait 3 seconds
go stack url myUrl
end downloadComplete
Cache does not work, infact it seems always empty, furthermore:
repeat while ( (the urlStatus of myUrl) is not "cached") and (myTimer < myTimerStart)
the flag (the urlStatus of myUrl) is always "connected".
repeat while the urlStatus of myUrl is not "cached" and (myTimer < myTimerStart)
or
repeat while the urlStatus(myUrl) is not "cached" and (myTimer < myTimerStart)
on downloadUrl
put "http://...." into myUrl
load url myUrl with msg "foo"
send "bar myUrl" to me in 200 millisecs
end downloadUrl
on bar theUrl
put urlStatus(theUrl) into myStatus
if myStatus contains "contacted" or myStatus contains "loading" then
send "bar theUrl" to me in 200 millisecs
end if
end bar
on foo
put "done"
end foo
Actually, you may need to tweak the if statement in the bar handler a little more (and you will probably want to change the hander names).
Kind regards,
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode