CrowScape
11-21-2002, 05:46 AM
I've created a very complicated slideshow script (view the page at http://www.notredameparish.org/campaign_index.htm) and to let the user control it I made a group of six buttons much like you would find on a CD player that react to OnMouse events. Offline the script works perfectly. However, online the problem I have is mostly generated when the user hits "play" or "pause." On occasion instead of changing the image on an OnMouseDown it simply doesn't display it (play around with the page and you'll see what I'm talking about). At first I thought it was because I hadn't preloaded some of the buttons, but I did that and that had no effect. So then I thought that maybe loading the next set of images for the slideshow was causing the computer to simply forget to change the image (or time out or something), so I added a half second delay to the slideshow commands. No dice.
Anyway, here's the script controling the two problem buttons:
<script language="JavaScript">
playStat = 0;
playPath = "images/vcr_play";
pausePath = "images/vcr_pause";
play01= new Image();
play01.src=playPath + "_on.gif";
play02= new Image();
play02.src=playPath + ".gif";
play03= new Image();
play03.src=playPath + "_over.gif";
pause01= new Image();
pause01.src=pausePath + "_on.gif";
pause02= new Image();
pause02.src=pausePath + ".gif";
pause03= new Image();
pause03.src=pausePath + "_over.gif";
function playButton()
{playStat = 1;
document.images["play"].src = play01.src;
document.images["pause"].src = pause02.src;
}
function playOver()
{if (playStat == 0)
document.images["play"].src = play03.src;
}
function playOut()
{if (playStat == 0)
document.images["play"].src = play02.src;
}
function pauseButton()
{playStat = 0;
document.images["play"].src = play02.src;
document.images["pause"].src = pause01.src;
}
function pauseOver()
{if (playStat == 1)
document.images["pause"].src = pause03.src;
}
function pauseOut()
{if (playStat == 1)
document.images["pause"].src = pause02.src;
}
</script>
Anyway, here's the script controling the two problem buttons:
<script language="JavaScript">
playStat = 0;
playPath = "images/vcr_play";
pausePath = "images/vcr_pause";
play01= new Image();
play01.src=playPath + "_on.gif";
play02= new Image();
play02.src=playPath + ".gif";
play03= new Image();
play03.src=playPath + "_over.gif";
pause01= new Image();
pause01.src=pausePath + "_on.gif";
pause02= new Image();
pause02.src=pausePath + ".gif";
pause03= new Image();
pause03.src=pausePath + "_over.gif";
function playButton()
{playStat = 1;
document.images["play"].src = play01.src;
document.images["pause"].src = pause02.src;
}
function playOver()
{if (playStat == 0)
document.images["play"].src = play03.src;
}
function playOut()
{if (playStat == 0)
document.images["play"].src = play02.src;
}
function pauseButton()
{playStat = 0;
document.images["play"].src = play02.src;
document.images["pause"].src = pause01.src;
}
function pauseOver()
{if (playStat == 1)
document.images["pause"].src = pause03.src;
}
function pauseOut()
{if (playStat == 1)
document.images["pause"].src = pause02.src;
}
</script>