
Downloading files from the Internet with Lingo or JavaScript syntax
475
To execute a network script operation:
1
Start the operation.
For example, the following statement initiates a text downloading operation and assigns the
network ID returned by the
getNetText()
operation to the variable
theNetID
:
theNetID = getNetText("http://www.thenews.com")
2
Make sure that the operation finishes.
To check an operation’s status regularly until the method indicates that the operation is
complete, use the
netDone()
method. For more information about this method, see the
Scripting Reference topics in the Director Help Panel.
For example, the following statement loops in the current frame until the download operation
is complete:
if not(netDone(theNetID)) then _movie.go(_movie.frame)
3
Check whether the operation was successful by using the
netError()
method. For more
information about this method, see the Scripting Reference topics in the Director Help Panel.
4
Obtain the results if the operation is complete.
Note:
You can also use getStreamStatus() to determine the status of a network operation. You can
use
netDone()
to check whether an operation is “done” or “not done”. By using getStreamStatus(),
you can check on an operation’s progress, as it displays how many total bytes there are and how
many have been downloaded so far.
To cancel a network operation in progress:
•
Use the
netAbort()
method to cancel a network operation without waiting for a result. This
frees up capacity for Internet access, which lets other network operations finish faster. For more
information about this method, see the Scripting Reference topics in the Director Help Panel.
To retrieve a file as text:
1
Use the
getNetText()
method or the
postNetText
method to start retrieving text. For more
information about this method, see the Scripting Reference topics in the Director Help Panel.
2
Use the
netTextResult()
method to return the text you retrieved with
getNetText
or
postNetText
. For more information about this method, see the Scripting Reference topics in
the Director Help Panel.
To retrieve and play a new Shockwave movie from the network:
•
Use the
gotoNetMovie()
method. For more information about this method, see the Scripting
Reference topics in the Director Help Panel.
The current movie continues to run until the new movie is ready to play. After the new movie is
ready, the player quits the current movie and plays the new movie in the same display area as the
calling movie.
To open a URL in the user’s browser:
•
Use the
gotoNetPage()
method. This method works whether the URL refers to Shockwave
content, HTML, or another MIME type. For more information about this method, see the
Scripting Reference topics in the Director Help Panel.
You can specify that this method replaces a page’s content or opens a new page. If the browser is
not open, the method launches the browser. If the
gotoNetPage
method replaces the page in
which the movie is playing, the movie keeps playing until the browser replaces the page.
Summary of Contents for DIRECTOR MX 2004-USING DIRECTOR
Page 1: ...DIRECTOR MX 2004 Using Director...
Page 16: ...16 Chapter 1 Introduction...
Page 82: ...82 Chapter 3 Sprites...
Page 98: ...98 Chapter 4 Animation...
Page 134: ...134 Chapter 5 Bitmaps...
Page 242: ...242 Chapter 10 Sound and Synchronization...
Page 274: ...274 Chapter 11 Using Digital Video...
Page 290: ...290 Chapter 12 Behaviors...
Page 302: ...302 Chapter 13 Navigation and User Interaction...
Page 334: ...334 Chapter 15 The 3D Cast Member 3D Text and 3D Behaviors...
Page 392: ...392 Chapter 16 Working with Models and Model Resources...
Page 418: ...418 Chapter 18 Movies in a Window...
Page 446: ...446 Chapter 22 Managing and Testing Director Projects...