This section contains reference material for the sequencer control and its methods and events, plus the following additional topics:
The Sequencer control provides timing and sequencing services for action sets, scripts used to control Microsoft® ActiveX Controls or scripts on the page. The sequencer calls Microsoft JScript, Microsoft Visual Basic(r) Scripting Edition (VBScript) or other Web scripts.
These procedures are called by the sequencer's At Method and can be performed once or they can be looped by the sequencer. The sequencer calls the named script with the parameter string and the resolved parameter string is executed. Note that this means unresolved parameters don't get executed.
To use the sequencer object, you must first instantiate it on the HTML page, as shown in the following syntax:
Syntax
<OBJECT id=object STYLE="" CLASSID=clsid:B0A6BAE2-AAF0-11d0-A152-00A0C908DB96> </OBJECT>
Parameters
object | Name of the sequencer, to be used in script. |
Method | Description |
At | Specifies a new action in the action set. |
Pause | Stops action set playback at current position. Keeps time pointer and queue. |
Play | Starts the action set (if stopped). Resumes sequencer playback if sequencer is paused. Ignored if sequencer is playing. |
Seek | Changes the current playback position of the action set to a new, specified time. |
Stop | Stops action set playback, resets its playback position to the beginning. |
Event | Description | Parameters |
OnInit | Occurs when sequencer is first completely loaded into memory. | |
OnPause | Occurs when action set playback has been paused. | Name of action set |
OnPlay | Occurs when the action set has started playback. This event is only called when the action set starts playback from a stopped or paused state, not when a currently playing action set loops back to the beginning to repeat playback. | Name of action set |
OnSeek | Occurs after the Seek method call has been completed. | Name of action set, new time |
OnStop | Occurs when the action set playback ends or is stopped. | Name of action set |
For optimal performance, use only one sequencer on a page with a single action set that calls a lot of actions. You can run multiple sequencers that each execute fewer action sets simultaneously but will get better performance with a single sequencer executing a larger number of action sets.
As the page is loaded, the sequencers used are loaded into memory. You can use the OnInit Event to ensure that the sequencers are fully loaded before starting their playback.
Sequencer Control VBScript Example
<HTML> <HEAD> <TITLE>Microsoft DirectAnimation Controls - Sequencer</TITLE> <SCRIPT LANGUAGE=VBSCRIPT> Sub Window_OnLoad call sgMSDHTML.SetIdentity Button1.value="Pause" End Sub Sub Seq_oninit call seq("ActionSet1").At(0.000, "RotateAll",-1, 0.050, 1) Call Seq("ActionSet1").Play End Sub Sub RotateAll Call sgMSDHTML.Rotate(0,9,2) End Sub Sub Start Select Case Button1.value Case "Play" Call Seq("ActionSet1").Play Button1.value="Pause" Case "Pause" Call Seq("ActionSet1").Pause Button1.value="Play" End Select End Sub </SCRIPT> </HEAD> <BODY BGCOLOR=BLACK> <OBJECT ID=sgMSDHTML STYLE="POSITION: ABSOLUTE; HEIGHT:300;WIDTH:450;TOP:100;LEFT:60;VISIBILITY:VISIBLE; ZINDEX:-1" CLASSID="CLSID:369303C2-D7AC-11d0-89D5-00A0C90833E6"> <PARAM NAME="Line0001" VALUE="SetLineColor(255,255,255)"> <PARAM NAME="Line0002" VALUE="SetFillColor(0,0,255)"> <PARAM NAME="Line0003" VALUE="SetFillSTYLE(1)"> <PARAM NAME="Line0004" VALUE="SetLineSTYLE(1)"> <PARAM NAME="Line0005" VALUE="SetFont('Verdana',60,650,0,0,0)"> <PARAM NAME="Line0006" VALUE="Text('Microsoft', -120, -100, 0)"> <PARAM NAME="Line0007" VALUE="Text('Dynamic', -120, -50, 0)"> <PARAM NAME="Line0008" VALUE="Text('HTML', -90, 0, 0)"> <PARAM NAME="Line0009" VALUE="Text('Multimedia', -120, 50, 0)"> </OBJECT> <OBJECT ID="Seq" CLASSID="CLSID:B0A6BAE2-AAF0-11d0-A152-00A0C908DB96" STYLE="WIDTH:2;HEIGHT:2"> </OBJECT> <INPUT TYPE=button ID="Button1" STYLE="POSITION:ABSOLUTE; TOP:10; LEFT:10; z-index:2; VALUE=""; OnClick="Start"> </BODY> </HTML>
Action Set
An action set is a logical grouping of named procedures that are used to control the timing and behavior of objects on the page. Action sets have the following properties:
Name | Description |
PlayState | Retrieves the current playback state of the action set: 0=stopped, 1=playing, 2=paused. Read-only at run time. |
Time | Retrieves the elapsed time in format seconds/milliseconds (SS.MSS) since the start of action set playback, including iterations. The default setting is zero. Read-only at run time. |
Retrieves the state of the sequencer. Read-only at run time.
VBScript Syntax
playstate = object(
"actionsetname"
) .PlayState
JScript Syntax
playstate = object.item(
"actionsetname"
) .Playstate
Represents the amount of time since the start of the sequencer's playback. Read-only at run time.
VBScript Syntax
Time = object(
"actionsetname"
) .Time
JScript Syntax
Time = object.item(
"actionsetname"
) .Time
Specifies an action to take place within an action set.
VBScript Syntax
call object(
"actionsetname"
).At(
time,
"script",
[loop,
interval,
tiebreak,
drop threshold]
)
JScript Syntax
object.item(
"actionsetname"
).At(
time,
"script",
[loop,
interval,
tiebreak,
drop threshold]
);
The drop threshold parameter is useful for optimizing sequencer performance by streamlining the number of actions that the sequencer has to perform at any given moment; for instance, when starting up a complex action set. Thoughtful use of this parameter can keep the sequencer from slowing down or speeding up from backlog of actions to be executed, and keep the timing of actions within reasonable tolerances.
Stops the sequencer's playback, but maintains the current playback position.
VBScript syntax
call object(
"actionsetname"
) .Pause
JScript Syntax
object.item(
"actionsetname"
).Pause( )
Starts the sequencer or resumes it if the sequencer was paused. If the sequencer is playing, the call is ignored.
VBScript Syntax
call object(
"actionsetname"
) .Play
JScript Syntax
object.item(
"actionsetname"
).Play( )
The following example starts a sequencer described by the Seq object when the page loads. This sequencer calls the MoveButton action set at time 0, and calls the named procedure MoveButton.
<SCRIPT LANGUAGE=vbscript> <!-- Sub window_onLoad Call Seq("MoveButton").Play End Sub --> </SCRIPT>
Changes the current playback position of the Sequencer to another specified point in playback.
VBScript Syntax
call object(
"actionsetname"
).Seek(
time
)
JScript Syntax
object.item(
"actionsetname"
).Seek(
time
)
Stops the sequencer and resets its position to the beginning.
VBScript Syntax
call object(
"actionsetname"
) .Stop
JScript Syntax
object.item(
"actionsetname"
).Stop( )
The following example stops the sequence when the btnEnd button is clicked.
<SCRIPT LANGUAGE=vbscript> <!-- Sub btnEnd_OnClick Call Seq("MoveButton").Stop End Sub --> </SCRIPT>
The sequencer automatically stops when the page is unloaded.
Called when the page is loaded, when the sequencer has finished loading into memory. At this point, the script is executed. This event is generally used to load the rest of the procedures to be run on the client side.
VBScript Syntax
Sub object_oninit
script
End Sub
JScript Syntax
<script language="javascript" for="object" event="oninit">
<!--
script
//--><script>
The following example shows the oninit event used to play SeqMgr once it has finished loading the other sequencers that it controls. In the example, SeqMgr controls Seq1_Action1.
<SCRIPT LANGUAGE="VBScript"> <!-- Sub SeqMgr_oninit() Call SeqMgr("ActionSet1").At(0.000,"Seq1_Action1",300,0.100,1,100.000) Call SeqMgr("ActionSet1").Play End Sub --> </SCRIPT>
Called when the sequencer playback is paused. At this point, the script is executed.
VBScript Syntax
Sub object_onpause(
actionsetname
)
script
End Sub
JScript Syntax
<script language="javascript" for="object" event="onpause(
actionsetname
) ">
<!--
script
//--><script>
The following example tests the actionsetname parameter passed (a variable set to the name of the action set last paused) conditionally executes a script based on which action set has been paused.
Sub Sequencername_onpause(actionsetname) If actionsetname = "ActionSet1" then button1.value = "Play" Else button1.value="Pause" Endif End Sub
Occurs when the sequencer starts playback. At this point, the script is executed.
VBScript Syntax
Sub SequencerName_onplay(
actionsetname
)
script
End Sub
JScript Syntax
<script language="javascript" for="object" event="onplay(
actionsetname
) ">
<!--
script
//--><script>
The following example tests the actionsetname parameter passed (a variable set to the name of the action set last played) and conditionally executes a script based on which action set has been played.
Sub Sequencername_onplay(actionsetname) If actionsetname = "ActionSet1" then Call Seq("ActionSet2").stop Else Call Seq("ActionSet1").stop Endif End Sub
Called after the Seek method is invoked against a sequencer has completed changing the playback position. At this point, the script is executed.
VBScript Syntax
Sub object_ onseek (
actionsetname,
newtime
)
script
End Sub
JScript Syntax
<script language="javascript" for="object" event="onseek(
actionsetname,
newtime
) ">
<!--
script
//--><script>
This event can be useful in determining where the sequencer playback has been moved and set up conditional action based on the sequencer's new position. However, you can't have an OnSeek event call a seek method that seeks to a position within the same action set from which the OnSeek event originated.
Sub Sequencername_onseek(actionsetname, time) If actionsetname = "ActionSet1" then If time = 10.000 then Call Seq("ActionSet2").Play Else Call Seq("ActionSet1").Play EndIf EndIf End Sub
Called when the sequencer is stopped. At this point, the script is executed.
VBScript Syntax
Sub SequencerName_onstop(
actionsetname
)
script
End Sub
JScript Syntax
<script language="javascript" for="object" event="onstop(
actionsetname
) ">
<!--
script
//--><script>
The following example tests the actionsetname parameter passed (a variable set to the name of the action set last stopped) and conditionally executes a script based on which action set has been played.
Sub Sequencername_onstop(actionsetname) If actionsetname = "ActionSet1" then Call Seq("ActionSet2").play Else Call Seq("ActionSet1").play Endif End Sub
© 1997 Microsoft Corporation. All rights reserved. Terms of Use.