The Sequencer control provides timing and sequencing services for action sets, scripts used to control ActiveX controls or scripts on the page. The sequencer calls Jscript, 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.
Syntax
<OBJECT id=object STYLE="" CLASSID=clsid:B0A6BAE2-AAF0-11d0-A152-00A0C908DB96> </OBJECT>
Parameters
object | The 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.
<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>
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:
Property Name | Description |
PlayState | Returns the current playback state of the action set. 0=stopped, 1=playing, 2=paused. Read-only at run time. |
Time | Returns the elapsed time in format seconds/milliseconds (SS.MSS) since the start of action set playback, including iterations. The default setting is zero (0). Read-only at run time. |
Returns the state of the sequencer. Read-only at run time.
VBScript Syntax playstate = object("actionsetname").PlayState
JScript Syntax playstate = object.item("actionsetname").Playstate
Parameter Description object Name of sequencer. actionsetname Name of the action set. playState Return value - integer, indicating play state of the sequencer. Possible values are 0 (stopped), 1(playing) or 2 (paused).
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
Parameter Description object Name of sequencer. actionsetname Name of the action set. Time Return value - float, format seconds.milliseconds (s.mss), the elapsed sequencer playback 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]);
Parameter Description object Name of sequencer. actionsetname Name of the action set. time Required. Double value, format: seconds.milliseconds (SS.MSS). Sets the start time for the specified action. script Required. Text string identifying the named procedure to be called. Can pass parameters as part of the script call, for example, script(param1) loop Optional. Integer. Sets the loop count for this action. The default is 1. If set to -1, looping is infinite. Any negative number other than -1 will be treated as 0. 0 loop count value prevents execution. This can be used to programmatically halt action set execution. interval Optional. Double value, format: seconds.milliseconds (SS.MSS). Sets the delay between iterations of this action. Minimum interval resolution is 20 milliseconds (00.020). The default is 33 milliseconds (00.033), equivalent to 30 frames per second. tie break Optional. Integer, -1(default), 0-n. Sets the priority for the action. In the event that two actions happen at the same time, the action with the lower tie break number will be performed first. 0 is the highest priority action that is capable of being dropped. -1 is the lowest priority action and will be executed last. drop threshold Optional. Double value, format: seconds.milliseconds (SS.MSS). Sets the time by which the action must be performed before it is dropped from the queue. The default value is for the action to never be dropped (-1.000).
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( )
Parameter Description object Name of sequencer. actionsetname Name of the action set.
Starts the sequencer or resumes it if the sequencer was paused. If the sequencer is currently playing, the call is ignored.
VBScript Syntax call object("actionsetname").Play
JScript Syntax object.item("actionsetname").Play( )
Parameter Description object Name of sequencer. actionsetname Name of the action set.
EXAMPLE: This 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)
Parameter Description object Name of sequencer. actionsetname Name of the action set. time New time for sequencer to continue playback.
Stops the sequencer and resets its current position to the beginning.
VBScript Syntax call object("actionsetname").Stop
JScript Syntax object.item("actionsetname").Stop( )
Parameter Description object Name of sequencer. actionsetname Name of the action set.
EXAMPLE: This 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>
Parameter Description object The name of the sequencer to be used in script. script Script to be executed.
This example shows the oninit event used to play SeqMgr once it has finished loading the other sequencers that it controls. In this 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>
Parameter Description object The name of the paused sequencer. ActionSet The name of the action set that has been paused as a consequence of the sequencer being paused.
This 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>
Parameter Description object The name of the sequencer played. actionsetname The name of the action set played by the sequencer.
This 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>
Parameter Description object The name of the sequencer. actionsetname The specific action set from which the Seek method was invoked. newtime The new playback time to which the sequencer has been moved.
This event can be useful in determining where the sequencer playback has been moved and set up conditional action based upon the sequencer's new position. However, you can not have an OnSeek event call a seek method that seeks to a position within the same actionset 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>
Parameter Description SequencerName The name of the sequencer stopped. actionsetname The name of the action set stopped by the sequencer.
This 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.