Syntax: | stream(member whichFlashSprite, numberOfBytes ) |
Type: | Command |
Description: | Use this command to manually stream 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 attempts 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 loaded 100 percent 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 how many bytes were 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 the percentStreamed of member 10 < 100 then set bytesReceived = stream(member 10, 32000) if bytesReceived < 32000) then set the text of member "Message Line" = ¬ "Received only" && bytesReceived && "of 32,000 bytes requested." updateStage else set the text of member "Message Line" = ¬ "Received all 32,000 bytes." end if go to the frame end if end |
|
![]() |