Lingo Dictionary > S > on streamStatus |  |

on streamStatus

Syntax

    on streamStatus URL, state, bytesSoFar, bytesTotal, error
    	statement(s)
    end

Description

System message and event handler; called periodically to determine how much of an object has been downloaded from the Internet. The handler is called only if `tellStreamStatus (TRUE)` has been called, and the handler has been added to a movie script.

The `on streamStatus` event handler has the following parameters:

`URL` | Displays the Internet address of the data being retrieved.
`state` | Displays the state of the stream being downloaded. Possible values are `Connecting`, `Started`, `InProgress`, `Complete`, and `Error`.
`bytesSoFar` | Displays the number of bytes retrieved from the network so far.
`bytesTotal` | Displays the total number of bytes in the stream, if known. The value may be 0 if the HTTP server does not include the content length in the MIME header.
`error` | Displays an empty string ("") if the download has not finished; OK (`OK`) if the download completed successfully; displays an error code if the download was unsuccessful.

These parameters are automatically filled in by Director with information regarding the progress of the download. The handler is called by Director automatically, and there is no way to control when the next call will be. If information regarding a particular operation is needed, call `getStreamStatus()`.

You can initiate network streams using Lingo commands, by linking media from a URL, or by using an external cast member from a URL. A `streamStatus` handler will be called with information about all network streams.

Place the `streamStatus` handler in a movie script.

Example

This handler determines the state of a streamed object and displays the URL of the object:

    on streamStatus URL, state, bytesSoFar, bytesTotal
    	if state = "Complete" then
    		put URL && "download finished"
    	end if
    end streamStatus

See also

`getStreamStatus()`, `tellStreamStatus()`