At 9:50 PM +0200 10/16/00, J�rn Madsen wrote:
>Hi list,
>
>I am having some problems with the following code:
>
>on exitFrame
>   global mynetID
>   set mynetID =
>preloadNetThing("http://www.myweb.com/textfile/fileCont.txt")
>
>   if netDone(mynetID) = FALSE then
>     go to the frame
>   else
>     alert "Downloaded"
>   end if
>
>   theText = getPref("fileCont.txt")
>   member("fileContent").text = theText
>end
>
>
>
>when the line theText = getPref.... is run I get an Script Error. Why?
>
>The file is downloaded and it is a frameScript.


There are a couple of things wrong with this code - but I don't see a 
script error.  The main things that I see are:

1)  You really only want to do your preloadNetThing once.  Your 
current code is asking to preload on every frame event.  You probably 
want something like this:

property  myNetID  -- probably no need to make this a global, just 
use a property

on beginSprite
   set mynetID =preloadNetThing("http://www.myweb.com/textfile/fileCont.txt")
end

on exitFrame 
   if netDone(mynetID) = FALSE then
     go to the frame
   else
     alert "Downloaded"
   end if

   theText = getPref("fileCont.txt")
   member("fileContent").text = theText
end

2)  Then, it's not clear what you are trying to do here.  Are you 
trying to preload a file, then when you have the file, then get the 
text from it?  Or are you really trying to talking to two different 
files?  (The file names are the same)  The first call to preload 
tries to preload a file from the internet into your cache, but the 
call to getPref tries to get the text out of a local file in your 
Director/Prefs directory.  A file like this is generated by a 
previous call to SetPref.

If you are trying to get the text of a local file, then use GetPref. 
If you want to get the text in a file from the internet (which is 
what I'm guessing you are really trying to do), then you can 
optionally use preloadNetThing, then use getNextText to to actually 
get the text.  Look up getNetText in the docs.

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