> How to preload members in background mode? 

Here's the quick'n'dirty explanation, then I'm going to refer you to the docs and some 
tech notes:

1. Initiate the preloadNetThing() process

tFoo = preloadNetThing(someUrl)

Use the above to start the download process; someUrl is the URL of the file you want 
to download to the user's cache and tFoo will now be an integer that is the download's 
ID number which will be used in the steps below.


2. Monitor the download progress

tDone = netDone(tFoo)

The above will return a boolean, TRUE if the download is completed, FALSE if it's in 
progress. When it returns true go to step 3. Notice that I used tFoo in the call to 
netDone(), I'm asking for the netDone() status of that particular stream, you can have 
multiple downloads in progress at one time.


3. When download is done, check it for errors

tError = netError(tFoo)

If the above returns "OK" then your download has completed and is error free, if it 
does not return "OK" then it will return a number which you can use to determine the 
failure that occurred.


It is important to note that you _must_not_ wait in a repeat loop for this to 
complete, network operations will not update their status while you sit in a repeat 
loop. Therefore it is recommended that you use frame events to monitor the download 
and its status. For example, here is a frame script that sits on the frame until a 
file is downloaded:

property pNetID

on beginSprite
  pNetID = preloadNetThing(someURL)
end

on exitFrame
  if (netDone(pNetID) = TRUE) then
    if (netError(pNetID) = "OK") then
      go to the frame + 1
    else
      -- insert your own error handling here
    end if
  else
    go to the frame
  end if
end 

You might also consider looking into the getStreamStatus() function as it will tell 
you how many bytes have been retrieved and how much there is total (progress bar!) if 
your server is configured correctly (to deliver header info IIRC). For future 
reference there are many tech notes to be found in the Macromedia Director Support 
Center, specifically these documents:

Director- preloadNetThing Show Me 
<http://www.macromedia.com/support/director/how/show/preldnetthing.html>

How do I use preLoadNetThing?
<http://www.macromedia.com/support/director/ts/documents/sample_preloadnetthing.htm>

What does preloadNetThing look like in action?
<http://www.macromedia.com/support/director/ts/documents/preloadnetthing.htm>

Note: all three of the above were found by going to the Support Center 
(<http://www.macromedia.com/support/director>) and searching using the term 
'preloadNetThing'. Hope that helps, good luck!

Cheers,
Tom Higgins
Product Specialist - Director Team
Macromedia

...

[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