<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Flash MP3 Player - Javascript Control Examples</title>
</head>
<body style="margin:50px;">
<h2>Javascript control examples.<br />Check the source code for a small explanation.<br />Won´t work locally due to Flash security restrictions! Test online...</h2>
<!-- these are all needed javascript functions -->
<script>
function sendEvent(typ,prm) {
thisMovie("mediaplayer").sendEvent(typ,prm);
}
function thisMovie(movieName) {
if (navigator.appName.indexOf("Microsoft") != -1) {
return window[movieName]
}
else {
return document[movieName]
}
}
function getUpdate(typ,pr1,pr2) {
var id = document.getElementById(typ);
id.innerHTML = typ+ ": "+Math.round(pr1);
pr2 == undefined ? null: id.innerHTML += ", "+Math.round(pr2);
}
</script>
<!-- this is the embed code for the mp3player -->
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="300" height="150" id="mediaplayer"
codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" >
<param name="movie" value="mediaplayer.swf" />
<param nam="allowScriptAccess" value="always">
<embed src="mediaplayer.swf" allowScriptAccess="always" width="300" height="150" name="mediaplayer"
type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>
<!-- this list contains an example of each javascript control -->
<h3>Send Events:</h3>
<ul>
<li><a href="javascript:sendEvent('playpause')">Toggle the pause state.</a></li>
<li><a href="javascript:sendEvent('scrub',25)">Scrub to 25 percent inside the song</a></li>
<li><a href="javascript:sendEvent('playitem',1)">Play the 2nd song of the playlist</a></li>
<li><a href="javascript:sendEvent('getlink',1)">Go to the 2nd link from the playlist</a></li>
<li><a href="javascript:sendEvent('volume',50)">set the volume to 50%</a></li>
</ul>
<h3>Received Updates:</h3>
<ul>
<li id="volume"></li>
<li id="state"></li>
<li id="time"></li>
<li id="load"></li>
<li id="item"></li>
</ul>
</body>
</html>