Lingo Dictionary > S > stream |
![]() ![]() ![]() |
stream
Syntax
member(
whichFlashSprite
).stream(
numberOfBytes
)
stream(member
whichFlashSprite, numberOfBytes
)
Description
Command; manually streams a portion of a specified Flash movie cast member into memory. You can optionally specify the number of bytes to stream as an integer value. If you omit the numberOfBytes
parameter, Director tries to stream the number of bytes set by the cast member's bufferSize
property.
The stream
command returns the number of bytes actually streamed. Depending on a variety of conditions (such as network speed or the availability of the requested data), the number of bytes actually streamed may be less than the number of bytes requested.
You can always use the stream
command for a cast member regardless of the cast member's streamMode
property.
Example
This frame script checks to see if a linked Flash movie cast member has streamed into memory by checking its percentStreamed
property. If the cast member is not completely loaded into memory, the script tries to stream 32,000 bytes of the movie into memory.
The script also saves the actual number of bytes streamed in a variable called bytesReceived
. If the number of bytes actually streamed does not match the number of bytes requested, the script updates a text cast member to report the number of bytes actually received. The script keeps the playback head looping in the current frame until the cast member has finished loading into memory.
on exitFrame if member(10).percentStreamed < 100 then bytesReceived = member(10).stream(32000) if bytesReceived < 32000 then member("Message Line").text = "Received only" && bytesReceived \ && "of 32,000 bytes requested." updateStage else member("Message Line").text = "Received all 32,000 bytes." end if go the frame end if end
![]() ![]() ![]() |