Hi Bjarne
I'm not sure what you mean by the NetID becoming 0, as far as I remember,
the NetID should be retained after the operation completes and isn't reset
until the next network command is called upon. You should be using NetDone
to see if the network operation for netID is completed.
example
global gNetID
on getTheData, l_Str_URL
gNetID = getNetText(l_Str_URL)
l_NetTimeOut = timeOut("Net Operation").new(5, #mRetrieveNetResult)
end getTheData
on mRetrieveNetResult l_Nothing, l_TimeOutRef
if netDone(gNetID) then
l_TimeOutRef.forget()
theData = netTextResult(gNetID)
-- you will need to figure out how to return the data accordingly.
end if
end mRetrieveNetResult
The above example assumes that you are attempting to do this in a
movieScript.
If on the other hand, you want to do this in a behaviour attached to a
sprite you can do it much more simply.
Example
property p_Str_URLToRetrieve
property p_Int_NetID
property p_Str_Result
on beginSprite( me )
-- whatever you want here
end beginSprite
on mouseUp( me )
if ilk( p_Int_NetID, #VOID ) then -- only attempt to retrieve if netID is
void
p_Int_NetID = getNetText( p_Str_URLToRetrieve )
end if
end mouseUp
on exitFrame( me )
if not( p_Int_NetID, #VOID ) then
if netDone( p_Int_NetID ) then
if netError( p_Int_NetID )<> "OK" then
-- there was an error in retrieving the url -- handle
it accordingly
else
-- it worked lets get the result
p_Str_Result = netTextResult( p_Int_NetID )
p_Int_NetID = VOID
end if
end if
end if
end exitFrame
on getPropertyDescriptionList
return\
[\
#p_Str_URLToRetrieve:[#Comment: "Enter the URL to retrieve result from",
#Format:#String, #Default:""]\
]\
end getPropertyDescriptionList
The above is an example only, and assumes you only need to retrieve from one
URL, you can make it more complex by hardcoding in a list of urls to
retrieve results from and then call each one.
You could further make this more generic by actuall encoding it into a frame
script, properties are valid there, and you can access the frame script via:
call(#mSomeHandlerName, sprite(0).scriptInstanceList[1])
sprite(0) is the frame or sprite channel where the frame script gets dropped
scriptInstanceList[1] is the actual script object of the frame script
Therefore you can call the frame script itself to set a property via a set
handler and then retrieve results using a get handler. Or if you so desire,
you can pass an instance reference to the handler making the call and then
having the framescript store that in a property until it returns a call back
to the behaviour that made the initial call.
Lots of ways to work things.
Beaware my first example using a timeout object requires D8 or above, the
rest should work in D7 or above.
NEVER USE A TIGHT REPEAT LOOP IN A NETWORK OPERATION TO CHECK THE NET STATUS
OF ANYTHING
sorry for the shout, but you can't use a tight repeat loop to check if
something is done with respect to the network operation as net ops are
performed on idle (I believe)
Just some ideas to get you thinking differently
Sincerely
Mark R. Jonkman
my apologies if the above is a little bit dyslexic.. my mind is 1684 Miles
away from here right now.
[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!]