Freigeben über


state Property

This topic documents a feature of HTML+TIME 2.0, which is obsolete as of Windows Internet Explorer 9.

Gets the current state of the element timeline.

Syntax

[ iState = ] currTimeState.state

Possible Values

iState An Integer that receives the one of the following values.
0
Timeline is inactive.
1
Timeline is active.
2
Timeline is cueing the media file.
3
Timeline is seeking the specified point in the media file.
4
Timeline is holding on the current element, waiting for the parent element timeline to end.

The property is read-only. The property has no default value.

Remarks

An element is considered active when it is in either a cueing state or a seeking state. Note that these two states apply only to elements containing media that can be played, such as an audio file or a video file.

Elements with the fill attribute set to hold or freeze will wait to synchronize with other elements on the page. An element is considered inactive when it is in a holding state. When an element is inactive, it cannot generate events or respond to events.

To get the state value as a string, use the stateString property.

Example

This example uses the state property to get the current state of the element timeline as an integer.

<HTML XMLNS:t ="urn:schemas-microsoft-com:time">
<HEAD>
<TITLE>state Property</TITLE>
<?IMPORT namespace="t" implementation="#default#time2">
<SCRIPT>
// Update each button based on the current timeline state
function updateBtns() {        
    switch (m1.currTimeState.stateString) {
        case "active":
            if (m1.currTimeState.isPaused == true) {
                playBtn.disabled = true;
                stopBtn.disabled = false;
                pauseBtn.disabled = true;
                resumeBtn.disabled = false;
            }
            else {        
                playBtn.disabled = true;
                stopBtn.disabled = false;
                pauseBtn.disabled = false;
                resumeBtn.disabled = true;
            }
            break;
        case "inactive":
            playBtn.disabled = false;
            stopBtn.disabled = true;
            pauseBtn.disabled = true;
            resumeBtn.disabled = true;
            break;
        case "holding":
            playBtn.disabled = false;
            stopBtn.disabled = true;
            pauseBtn.disabled = true;
            resumeBtn.disabled = true;
            break;                        
    }
}
</SCRIPT>

<SCRIPT FOR="document" EVENT="onclick" LANGUAGE="JScript">
    updateBtns();
</SCRIPT>

<STYLE>
    .time{ behavior: url(#default#time2);}
</STYLE>
</HEAD>

<BODY TOPMARGIN=0 LEFTMARGIN=0 BGPROPERTIES="FIXED" BGCOLOR="#FFFFFF"
    LINK="#000000" VLINK="#808080" ALINK="#000000" onload="updateBtns()">
Click the Current State button at any time to retrieve the integer value of the
element's current state. To start the movie clip, click the Begin button.
<BR><BR>

<t:video class="time" id="m1" begin="indefinite"
    style="position:absolute;top:90px;height:150px;"
    src="/workshop/samples/author/behaviors/media/movie.avi" fill="remove" />

<span id="state1" style="position:absolute;top:255px;">State: 0</span>

<P style="position:absolute;top:280px;">
<BUTTON id="b1" onclick="state1.innerText='State: ' + m1.currTimeState.state">
Current State</BUTTON>
<BUTTON id="playBtn" onclick="m1.beginElement();">Begin</BUTTON>
<BUTTON id="pauseBtn" onclick="m1.pauseElement();">Pause</BUTTON>
<BUTTON id="resumeBtn" onclick="m1.resumeElement();">Resume</BUTTON>
<BUTTON id="stopBtn" onclick="m1.endElement();state1.innerText='State: 0'">
    Stop</BUTTON>
</P>
</BODY>
</HTML>

Code example: http://samples.msdn.microsoft.com/workshop/samples/author/behaviors/state.htm

Applies To

currTimeState

See Also

Introduction to HTML+TIME, activeElements, isActive, isOn, isPaused