Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Swapping images and controlling the player

Streaming Media

Swapping images and controlling the player

by  tanderso  Posted    (Edited  )
In order to provide custom graphical controls which respond in both the player and the graphic, you'll have to set up functions which handle both tasks. Below is a simple example:

<head>
<script>
var stop_on = new Image();
stop_on.src = "stop_on.gif";
var stop_off = new Image();
stop_off.src = "stop_off.gif";
var play_on = new Image();
play_on.src = "play_on.gif";
var play_off = new Image();
play_off.src = "play_off.gif";
var pause_on = new Image();
pause_on.src = "pause_on.gif";
var pause_off = new Image();
pause_off.src = "pause_off.gif";

function swap([color green]img[/color],[color green]which[/color])
{
eval([color blue]"document."[/color]+[color green]img[/color]+[color blue]".src="[/color]+[color green]img[/color]+[color blue]"_"[/color]+[color green]which[/color]+[color blue]".src"[/color]);
}

function stop_player()
{
swap("stop","on");
swap("play","off");
swap("pause","off");

Player.stop();
}

function pause_player()
{
swap("stop","off");
swap("play","off");
swap("pause","on");

Player.pause();
}

function play_player()
{
swap("stop","off");
swap("play","on");
swap("pause","off");

Player.play();
}
</script>
</head>

<body>
<a href="javascript:stop_player()"><img src="stop_off.gif" name="stop"></a>
<a href="javascript:pause_player()"><img src="pause_off.gif" name="pause"></a>
<a href="javascript:play_player()"><img src="play_off.gif" name="play"></a>
</body>
Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top