At 5:22 PM -0500 1/4/01, grimmwerks wrote:
>I'm trying to get my head about something here....oh, that's a monitor...
>
>I'm trying to do a background task that will handle sending user info
>during a courseware product. What I'd like to do is have a background
>task that will queue the tracking information into it's own list, cycling
>through each in it's own proplist, making sure they're received and
>removing it from the list (since 4 asynch messages might be solid).
>
>Now, the question: should I do this as a parent script (ie new) and
>during the course sending parameters to the object to add new tasks, or
>just tossing them to the actorlist and having the main moviescript
>enterframe check each?
>
>...actually reading through this I'm not sure if I'm making myself clear,
>sounds like a 'duh' answer will be forthcoming....
>

Sounds like an excellent place for a global "Net" object whose job is 
to handle postNetText operations.  It should put itself into the 
actorList so it gets "serviced" every frame event.  Something like 
this (completely untested):

property plNetIds  -- property that is a list of NetIDs
property pnIDs  -- the number of IDs currently in use

on new me
   plNetIDs = []
   pnIds = 0
   add(the actorList, me)
   return me
end

on mNewRequest me, someParams
   if pnIDs = 4 then
      alert("Sorry, all full right now")
       return me
   end
   netID = postNetText(someParams)
   add(plNetIDs, netID)
   pnIds = pnIds + 1
end

on stepFrame me
   if pnIDs = 0 then
     return  -- nothing to do
   end if

    repeat with i = pnIDs down to 1  -- allows for easy deletion
      thisID = plNetIDs[i]
      if netDone(thisID) then
          -- do whatever you want here
          -- perhaps a callback passed in with the mNewRequest call
          deleteAt(plNetID)
          pnIDs = pnIDs - 1
       end if
     end repeat
end

on mCleanUp me
   deleteone(the actorList, me)
end


And you need the movie scripts:
  global gNetObject

on StartMovie
  gNetObject = new(script "Net")
end

on stopMovie
   gNetObject.mCleanUp()
   gNetObject = VOID

Then when you want to make a request do this:

   global gNetObject
   gNetObject.mNewRequest, someParams)

Irv

-- 
Lingo / Director / Shockwave development for all occasions.

        (Over two millions lines of Lingo code served!)

[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!]

Reply via email to