/    Sign up×
Community /Pin to ProfileBookmark

rollerover image(s) help!

Hi guys! This may sound confusing, but after a week of working on this project I am beat. I have an image, which is a mute button and when would like for the user to be able to click on it so it changes to another image. That I can do fine, but when the user clicks to unmute the image, I don’t know what logic to use. Here is what I have so far.

The same would apply to the play and pause images, but as of now I have them seperately.

[CODE]<HTML>
<HEAD>
<TITLE>Video Top Right</TITLE>
<meta name=”robots” content=”noindex”>
<!– #Include Virtual=”/_Videos/inc/Styles.inc” –>
<script src=”/_Videos/inc/slider.js” type=”text/javascript” language=”javascript1.2″></script>
<script language=”JavaScript”>
<!–
function moveFunction(sliderPosition) {
volSlider.setPosition(sliderPosition);
VIDEO.settings.volume = Math.round( 100 * sliderPosition );
}

function stopFunction(sliderPosition) {
volSlider.setPosition(sliderPosition);
}

function PlayVideo() {
VIDEO.controls.Play();
bPlayVideo = true;
}

function PauseVideo() {
VIDEO.controls.pause();
}

function MuteClick() {
VIDEO.settings.mute=(VIDEO.settings.mute ? false : true);
}

function fullScreen() {
VIDEO.fullScreen = ‘true’;
}

function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf(“#”)!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf(“?”))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//–>
</script>

</HEAD>
<BODY bgcolor=”#143064″ leftmargin=”0″ topmargin=”0″ rightmargin=”0″ bottommargin=”0″ >

<table align=”left” width=”350″ border=”0″ cellpadding=”0″ cellspacing=”0″>
<tr>
<td rowspan=”2″><img src=”/_Videos/images/VideoRight_1.gif” width=”10″ height=”285″></td>
<td><img src=”/_Videos/images/VideoRight_2.gif” width=”325″ height=”12″></td>
<td rowspan=”2″><img src=”/_Videos/images/VideoRight_3.gif” width=”15″ height=”285″></td>
</tr>
<tr>
<td align=”center” valign=”top” bgcolor=”f0f7ff”>
<% Call subPlayerObject(iVideoId, strFileName, VIRTUAL_VIDEO_PATH) %><br>
<table cellpadding=”2″ cellspacing=”1″ bgcolor=”#f0f7ff” border=”0″>
<tr>
<td align=”left” valign=”middle”>
<a href=”#” onMouseOut=”MM_swapImgRestore()” onMouseOver=”MM_swapImage(‘play’,”,’/_Videos/images/ButtonPlay_Down.gif’,1)” onClick=”PlayVideo();”><img src=”/_Videos/images/ButtonPlay.gif” alt=”Play” name=”play” width=”25″ height=”17″ border=”0″></a>
<a href=”#” onMouseOut=”MM_swapImgRestore()” onMouseOver=”MM_swapImage(‘pause’,”,’/_Videos/images/ButtonPause_Down.gif’,0)” onClick=”PauseVideo();”><img src=”/_Videos/images/ButtonPause.gif” alt=”Pause” name=”pause” width=”25″ height=”17″ border=”0″></a>
<a href=”#” onMouseOut=”MM_swapImgRestore()” onMouseOver=”MM_swapImage(‘rewind’,”,’/_Videos/images/ButtonRW_Down.gif’,0)” onClick=”if(VIDEO.controls.isAvailable(‘FastReverse’)) VIDEO.controls.fastReverse();”><img src=”/_Videos/images/ButtonRW.gif” alt=”Rewind” name=”rewind” width=”22″ height=”17″ border=”0″></a>
<a href=”#” onMouseOut=”MM_swapImgRestore()” onMouseOver=”MM_swapImage(‘fast_forward’,”,’/_Videos/images/ButtonFF_Down.gif’,0)” onClick=”if(VIDEO.controls.isAvailable(‘FastForward’)) VIDEO.controls.fastForward();”><img src=”/_Videos/images/ButtonFF.gif” alt=”Fast Forward” name=”fast_forward” width=”22″ height=”17″ border=”0″></a>
<a href=”#” onMouseOut=”MM_swapImgRestore()” onMouseOver=”MM_swapImage(‘fullscreen’,”,’/_Videos/images/ButtonFullscreen_Down.gif’,0)” onClick=”fullScreen();”><img src=”/_Videos/images/ButtonFullscreen.gif” alt=”Full Screen” name=”fullscreen” width=”75″ height=”17″ border=”0″></a>
<a href=”#” onClick=”MuteClick(); MM_swapImgRestore(); MM_swapImage(‘mute’,”,’/_Videos/images/ButtonMute_Down.gif’,0)”><img src=”/_Videos/images/ButtonMute.gif” alt=”Mute” id=”mute” name=”mute” width=”52″ height=”17″ border=”0″></a>
<img src=”/_Videos/images/VolumeIcon.gif” width=”15″ height=”15″ alt=”Volume” name=”Volume”>
</td>
<td valign=”middle”>
<script language=”JavaScript”>
<!–
var volSlider = new slider(
3, //height of track
40, //width of track
‘#143064’, //colour of track
0, //thickness of track border
‘#143064’, //colour of track border
4, //thickness of runner (in the middle of the track)
‘#143064’, //colour of runner
6, //height of button
10, //width of button
‘#c0c0c0’, //colour of button
1, //thickness of button border (shaded to give 3D effect)
‘<SPAN style=”font-size:6px;”></span>’, //text of button (if any)
true, //direction of travel (true = horizontal, false = vertical)
‘moveFunction’, //the name of the function to execute as the slider moves
‘stopFunction’, //the name of the function to execute when the slider stops
//the functions must have already been defined (or use null for none)
true
);
var DefaultPosition = 0.5;
volSlider.setPosition(DefaultPosition);
–>
</script>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan=”3″ background=”/_Videos/images/VideoRight_4.gif” valign=”top” width=”350″ height=”94″>
<table align=”center” width=”315″ cellpadding=”2″ cellspacing=”4″ border=”0″>
<tr>
<td class=”HeaderSmall” align=”center” valign=”top”>
<%= strVideoHeadline %><br>
</td>
</tr>
<tr>
<td class=”TextSmaller” align=”left” valign=”top”>
<%= strDescShort %>
<% If Trim(strDescLong) <> “” Then %>
&nbsp;<a class=”LinkSmall” title=”<%= strDescLong %>” href=”#” onclick=”window.open(‘/_Videos/VideoDescriptionLong.asp?video_id=<%= iVideoId %>’,’video_descr_long’,’menubar=no,location=no,toolbar=no,status=no,scrollbars=yes,resizable=no,width=400,height=600,top=30,left=5′); return false”>Read More…</a>
<% End If %>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan=”3″><br><p align=”center”><input type=”Button” value=”Close” onclick=”self.close()”></p></td>
</tr>
</table>

</BODY>
</HTML>[/CODE]

Any ideas or help would be much appreciated!

to post a comment
JavaScript

4 Comments(s)

Copy linkTweet thisAlerts:
@LogicianJul 24.2006 — Hi guys! This may sound confusing, but after a week of working on this project I am beat. I have an image, which is a mute button and when would like for the user to be able to click on it so it changes to another image. That I can do fine, but when the user clicks to unmute the image, I don't know what logic to use. Here is what I have so far.

The same would apply to the play and pause images, but as of now I have them seperately.

[CODE] <a href="#" onClick="MuteClick(); MM_swapImgRestore(); MM_swapImage('mute','','/_Videos/images/ButtonMute_Down.gif',0)">[/code][/QUOTE]
Create a flag to store the state of the button:<i>
</i>var isMute=false;
Then use the following as the parameter for the image to be displayed. Change the names as required and ensure case is maintained.
<i>
</i>'/_Videos/images/ButtonMute_' + ((isMute^=true) ? 'Up':'Down') + '.gif'
Copy linkTweet thisAlerts:
@biniciauthorJul 24.2006 — Thank you!

NvM, I didn't have the images swapping correctly. Works like a charm now! One more thing if possible, since the controls (methods) of the Play and pause are independent, how would it be possible to swap the images from playing to pause, and vica versa?

Thank you again,

BiNiCi
Copy linkTweet thisAlerts:
@biniciauthorJul 24.2006 — Hi again, I figured that portion out, now I have a problem...

My volume slider,

function moveFunction(sliderPosition) {

volSlider.setPosition(sliderPosition);

VIDEO.settings.volume = Math.round( 100 * sliderPosition );

}

function stopFunction(sliderPosition) {

volSlider.setPosition(sliderPosition);

}

anytime a user now slides the volume to increment or decrease the value it works, but if the image and function is on mute, how could I resolve that issue? Would I use an onfocus or unblur event? Oh man, can't believe its almost over...

Thanks again!
Copy linkTweet thisAlerts:
@LogicianJul 24.2006 — Hi again, I figured that portion out, now I have a problem...

My volume slider,

function moveFunction(sliderPosition) {

volSlider.setPosition(sliderPosition);

VIDEO.settings.volume = Math.round( 100 * sliderPosition );

}

function stopFunction(sliderPosition) {

volSlider.setPosition(sliderPosition);

}

anytime a user now slides the volume to increment or decrease the value it works, but if the image and function is on mute, how could I resolve that issue? Would I use an onfocus or unblur event? Oh man, can't believe its almost over...

Thanks again![/QUOTE]
I didn't notice initially that you have a 'muted' flag already: VIDEO.settings.mute . I would substitute that for isMuted throughout and test its value to decide whether or not the slider moves and/or has any effect.
×

Success!

Help @binici spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.2,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,
)...