Using Director > Playing Movies over the Internet > Downloading files from the Internet with Lingo |
![]() ![]() ![]() |
Downloading files from the Internet with Lingo
Lingo uses the Internet's resources by obtaining files from the Internet. The data is copied to the local disk or cache. After data is available on the local computer, use Lingo to retrieve the data for the movie. See Retrieving network operation results with Lingo.
For a movie or projector playing outside a browser, background loading isn't required. However, preloading is a good idea because it improves playback performance.
All network Lingo operations that obtain data from the network begin downloading the data and return a network ID. The data isn't immediately available.
An unlimited number of network Lingo operations can take place at once. When multiple network Lingo operations run simultaneously, rely on the network ID that the function returns to distinguish which operation is complete. Be aware that running more than four operations at once usually adversely affects performance.
When using network Lingo, the current handler must finish before an operation's result is returned. For best results, place Lingo that initiates a network operation and Lingo that uses the operation's result in different handlers. An on exitFrame
handler is a good location for checking whether an operation is complete.
To execute a network Lingo operation:
1 |
Start the operation. |
For example, this statement initiates a text downloading operation and assigns the network ID returned by the |
|
set theNetID = getNetText("http://www.thenews.com") |
|
2 |
Make sure the operation finishes. |
To check an operation's status regularly until the function indicates that the operation is complete, use the |
|
For example, this statement loops in the current frame until the download operation is complete: |
|
if not netDone(theNetID) then go to the frame |
|
3 |
Check whether the operation was successful by using the |
4 |
Obtain the results if the operation is complete. |
![]() |
To cancel a network operation in progress:
Use the netAbort
command to cancel a network operation without waiting for a result. This frees up capacity for Internet access, which allows other network operations to finish faster. See netAbort
.
To retrieve a file as text:
1 |
Use the |
2 |
Use |
![]() |
To retrieve and play a new Shockwave movie from the network:
Use the gotoNetMovie
command. See gotoNetMovie
.
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 without warning 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
command. This command works whether the URL refers to a Shockwave Director movie, HTML, or another MIME type. See gotoNetPage
.
You can specify that this command replace a page's content or open a new page. If the browser isn't open, the command launches the browser. If the gotoNetPage
command replaces the page that the movie is playing in, the movie keeps playing until the browser replaces the page.
The gotoNetPage
command is similar to Director's open
command. It doesn't return a value.
To preload a file from the server into the cache:
Use the preloadNetThing()
function. See preloadNetThing()
.
The preloadNetThing()
function initiates downloading a linked movie asset into the cache, where it is available for later use. Director can later preload the asset into memory without a download delay.
The current movie continues playing while preloading takes place.
To test whether getNetText(), preloadNetThing, or gotoNetMovie operations are complete:
Use the netDone()
function. See netDone()
.
To post information to a server and retrieve a response:
Note: Use the postNetText
command. See postNetText
.Executing any network Lingo operations concurrently with a Shockwave Audio (SWA) stream can cause interruptions in the playback of the SWA stream.
![]() ![]() ![]() |