Here is how to customize the Silverlight 2 templates to allow scripting.
1) In Expression Encoder SP1 select the template you would like to script (e.g. “Silverlight 2 Default”) and invoke the “Edit Copy in Visual Studio” command.
2) In VS find the “ExpressionPlayer” class and add the [ScriptableType] attribute to the class.
3) For each of the public methods that you need to invoke from script add the [ScriptableMember] attribute. Note: some of the methods you may want are defined in the “MediaPlayer” class that “ExpressionPlayer” is derived from. e.g. the “Stop” method is defined in “MediaPlayer”
4) In the constructor for the “ExpressionPlayer” class add:HtmlPage.RegisterScriptableObject("playerObject", this);
5) In default.html name the Silverlight object e.g. <object id=”PLAYER” … >
6) In your JS you can then write script like:var player = document.all(“PLAYER”);player.Content.playerObject.Stop();