It's a bit more complicated than that. The problem is that net operations are asynchronous events. So, you send one off, (e.g. getNetText), then you have to periodically check to see when it is done by calling "netDone". However, you have to "give it some time" to actually perform the operation. By putting the check in a repeat loop, Director does not have time to actually do the net operation, and you will get a infinite loop.

There are a number of different ways to handle this. But the best way depends on what kind of script you are executing from. If this is a behavior, then you can check in your "on exitFrame" script. If this is a parent script, you can add your object to the actorList and check in an "on stepFrame" handler. Or, if this is a movie level call, you can build a timeout object to get repeated callbacks where you can check to see if the operation is done.

Only when you get a postive result from netDone, then you can get the real results in the NetTextResult.

Irv




At 3:16 PM -0800 3/4/03, Timothy Lynn wrote:
Hi there,

Just found the list today, and I'm hoping someone might be able to lend a
hand here. I'm working on a movie that needs to submit information to a
database via a getNetText() to a php script that does the insert. Here's the
relevant code:

on insertUser (RFIDSN,ScreenName,Language,GroupID,Member)
  global domain

  insertNetID = getNetText(domain&"insert.php?rfidsn="&\
                URLEncode(RFIDSN)&"&screenname="&\
                URLEncode(ScreenName)&"&language="&\
                URLEncode(Language)&"&groupid="&\
                URLEncode(GroupID)&"&member="&\
                URLEncode(Member))

  put insertNetID          -- produces expected result
  put nettextresult()      -- produces ""
  put netmime(insertnetid) -- produces ""
  put netError(insertnetID)-- produces ""
end

Getting the php page produces the expected result, that is a new record in
our database. However, when I do a NetTextResult(), I should be getting back
an "OK" or an error condition. For some reason I can't find, I get nothing
out of it though. I've checked the mime type in my browser, and it's being
served as text/html, if that's any concern as well.

I also tried waiting until I got netDone with:

repeat while not netDone(insertNetID)
  next repeat
end repeat
put NetTextResult()

This results in a seemingly infinite loop. Is it possible that there's a
keep-alive happening somewhere along the lines here?

Thanks very much for any guidance,
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 Timothy Lynn          Web Technical Developer
 Talk: 408-795-6354   Write: [EMAIL PROTECTED]
         Read: http://www.thetech.org/
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

[To remove yourself from this list, or to change to digest mode, go to http://www.penworks.com/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/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!]

Reply via email to