Bjarne,
Aha. The problem is that net operations need to be asynchronous.
That is, you have to issue the operation and then come back every
once in a while and check. But a tight repeat loop doesn't give the
processor any time to do this. Instead, use a behavior something
like this (untested):
property spriteNum
property pURL
property pNetID
property pfComplete
on beginSprite me
-- Start the operation and store the netID
pNetID = getNetText( <Your URL> )
-- Set the completion flag to FALSE
pfComplete = FALSE
end
on exitFrame me
-- Only continue if the operation hasn't completed
if pfComplete then
go to the frame
end if
-- If the operation for this ID is completed then check the results
if netDone(pNetID) then
-- Get the result text from the operation
textFromNet = netTextResult( pNetID )
-- Check that the result is OK and not an error
if netError( pNetID ) = "OK" then
-- Got it
-- do whatever you want with "textFromNet"
end if
-- Set the flag that the operation has completed
pfComplete = TRUE -- or move on to another frame, etc.
end if
end
At 6:22 PM +0200 5/9/01, Bjarne Nyquist wrote:
> > Try a netTextResult() after the getNetText operation is complete.
>
>Thanx but sorry. The problem is that the network operation never gets done,
>i e the netID never becomes 0. If I do this with a regular HTML everything
>is OK, but as soon as I try a CGI call the operation goes in to a dead lock.
>This happens with all CGI calls I do, so there must be something i am
>missing.
>
>Here are two code examples I tried.
>
>on getTheData
> startTimer
> netID =
>getNetText("http://htmlgritch.island.com/SERVICE/QUOTE?STOCK=qqq")
> repeat while netID
> if the timer > 600 then
> put "time out"
> exit repeat
> end if
> end repeat
> theData = netTextResult(netID)
> return theData
>end getTheData
>
> startTimer
> netID = getNetText("http://htmlgritch.island.com/SERVICE/QUOTE",
>[#stock:"qqq"])
> repeat while netID
> if the timer > 600 then
> put "time out"
> exit repeat
> end if
> end repeat
> theData = netTextResult(netID)
> return theData
>end getTheData
>
>
>No go...
>
>Bjarne
>_____________________________________________________
>Bjarne Nyquist
>Researcher/Lingo Programmer
>www.interactiveinstitute.se
>+46-8783 24 74
>----- Original Message -----
>From: <[EMAIL PROTECTED]>
>To: <[EMAIL PROTECTED]>
>Sent: Wednesday, May 09, 2001 4:54 PM
>Subject: Re: <lingo-l> retrieving data from the internet
>
>
>>
>> Hi,
>>
>>
>> Something like this
>>
>> on beginSprite me
>> myNetID = getNetText(myUrl.com)
>> end beginSprite me
>>
>> on exitFrame me
>> if netDone(myNetID) then
>> put netTextResult(myNetID)
>> end if
>> end exitFrame me
>>
>>
>> Regards,
>> Pranav
>> -----------------------------------------------------------
>> "Simply stated, it is sagacious to eschew obfuscation."
>> --Norman Augustine
>>
>>
>>
>>
>> <obliterated>
>> i would like Director to retreive the page You get when You type the URL
>> below in a browser locator field
>>
>> http://htmlgritch.island.com/SERVICE/QUOTE?STOCK=qqq
>>
>> I tried reading up on the getNetText() function which is supposed to do
>> CGI
>> calls a well as straght forward HTML calls, but I can't get the hang of
>> it.
>> <obliterated>
>>
>>
>>
>> [To remove yourself from this list, or to change to digest mode, go to
>> http://www.penworks.com/LUJ/lingo-l.cgi To post messages to the list,
>> email [EMAIL PROTECTED] (Problems, email [EMAIL PROTECTED])
>> Lingo-L is for learning and helping with programming Lingo. Thanks!]
>
>
>[To remove yourself from this list, or to change to digest mode, go to
>http://www.penworks.com/LUJ/lingo-l.cgi To post messages to the list,
>email [EMAIL PROTECTED] (Problems, email [EMAIL PROTECTED])
>Lingo-L is for learning and helping with programming Lingo. Thanks!]
--
Lingo / Director / Shockwave development for all occasions.
(Home-made Lingo cooked up fresh every day just for you.)
[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/LUJ/lingo-l.cgi To post messages to the list,
email [EMAIL PROTECTED] (Problems, email [EMAIL PROTECTED])
Lingo-L is for learning and helping with programming Lingo. Thanks!]