Adding Events Scripts


Adding and opening events is more complex than the other scripts, so we will attempt to explain this in more detail and provide a sample code.

The EVENT and OPENEVENT work in unison. It is advised that the OPENEVENT be employed because it pre-buffers (i.e. prepares it) the content for the upcoming EVENT.

  1. First, insert the EVENT script and choose it from the drop-down menu. (Follow the instructions in the last section.) Type in the name of the EVENT and click OK.

  2. Select an area before the EVENT is to take place and insert an OPENEVENT. Ten seconds is a suitable time. For the argument string, simply type the name of the event and then click OK.

  3. Now, create a metafile (ASX). Please refer to Creating Windows Media Metafiles & Adding HTML Tags for more details on the reason behind metafiles and how you create one.

  4. Add the following EVENT tag into your metafile and be sure to enter in your personal file information:

<EVENT Name="yourparameter">
<ENTRY>
<TITLE>"Demo"</TITLE>
<REF href="yourfile.wmv"/>
</ENTRY>
</EVENT>

  1. The final step is to add JavaScript into one of your HTML pages, which should be the frame that controls the streaming file. (Please refer to Embedding Windows Media Player in your Browser for more information.) Now, add the following JavaScript, which demonstrates a message (using alert) and be sure to enter in your personal file information:

<SCRIPT for="NSPlay" event="SCRIPTCommand(Type, Param)" LANGUAGE="JScript">  switch (Param) {
  case "yourparameter":
  alert ("yourmessage");
  break; }
</Script>