Share via


Windows Media Player 11 SDK Writing Event CodeĀ 

Windows Media Player SDK banner art

Previous Next

Writing Event Code

Events are treated similarly to attributes. You must give the event a value, and the value is the code you want to run when the event happens. The word "on" is added to the front of the event name; for example, the click event will become onclick.

The event value is in double quotes and starts with the word JScript followed by a colon. The code you want to run comes next, followed by a semicolon and the closing double quotes. For example, to stop playing when the user clicks on a button, type the following as an attribute in your BUTTON element code:

onclick = "JScript: player.Controls.Stop() ; " 

If you have a code that requires quotes, use single quotes. Care must be taken when using quotation marks so that they are balanced properly. Here is an example of using both types:

onclick = "JScript: player.URL = 'https://proseware.com/laure.wma' ; " 

You can also change attributes of your skin when handling an external event. For example, to close a view named myView, you could type:

onclick = "JScript: myView.close() ;"

See Also

Previous Next