User Guide

630
Example
The following frame script checks to see if a Flash movie cast member named Intro Movie has
finished streaming into memory. If it hasnt, the script reports in the Message window the current
state of the cast member and keeps the playhead looping in the current frame until the movie
finishes loading into memory.
on exitFrame
if member("Intro Movie").percentStreamed < 100 then
put "Current download state:" && member("Intro Movie").state
go the frame
end if
end
See also
clearError, getError()
state (RealMedia)
Syntax
sprite(whichSprite).state
member(whichCastmember).state
Description
RealMedia sprite or cast member property; returns the current state of the RealMedia stream,
expressed as an integer in the range 1 to 4. Each state value corresponds to a specific point in the
streaming process. This property is dynamic during playback and can be tested but not set.
The streaming process is initiated when the playhead enters the span of the RealMedia sprite in
the Score, the
play method is invoked on a RealMedia sprite or cast member, or a user clicks the
Play button in the RealMedia viewer. Calling this property returns a numeric value indicating the
state of the streaming process for the RealMedia cast member. For each state there is one or more
corresponding
mediaStatus property value; each mediaStatus value is observed only in one
state. For example, the
mediaStatus property values #seeking and #buffering are present only
when the value of state is 3.
The value of the
state property provides important information in terms of performing Lingo on
a cast member. If member.state is less than 2, some of the Lingo properties may be incorrect, and
as a result, any Lingo relying on property data would be incorrect. When
member.state is greater
than or equal to 2 and less than 4, the RealMedia cast member is not displayed, but all the Lingo
properties and methods have well-defined values and can be used to perform Lingo operations on
the cast member.
When the streaming process is initiated, the
state property cycles through the following states,
unless an error (-1) occurs, which prevents the streaming process from starting:
-1 (error) indicates that there is something wrong, possibly a leftover error from the previous
RealMedia stream. You may get more information by checking the
lastError property. This
state is the equivalent of
#error for the mediaStatus property.
0 (closed) indicates that streaming has not begun, or that cast member properties are in initial
states or are copies from an earlier playing of the cast member. This state is the equivalent of
#closed for the mediaStatus property.