PDA

View Full Version : how to control the volume of the swf file using javascript



satyaala
28 Nov 2008, 02:46 AM
Hi..

I am facing a problem while playing the flash file and i am seeking ur help in this.

i have three files footer.html(containing volume control buttons),index.html and one swf file.

Now the problem my code in the footer.html doesnt turn on and off the volume of the swf file.

ie.if i clicked on the volume button ,the volume is not turning off...
footer.html


<html>
<head>
<title>footer</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
body,td,th {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px;
}
body {
background-color: #1D5081;
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 5px;
background-image: url(../images/main_bg.gif);
}
-->
</style>

<script language="JavaScript">
<!--

document.oncontextmenu = NoRClkMenu
document.onkeydown= SendKey

//======================================================================
function SendKey()
{
parent.Navigation.SetKey(event.keyCode)
}//end function

function NoRClkMenu()
{
event.returnValue = false
}//end function


function SendAudStatus()
{
var theStatus
//alert("in sendAudStatus before fetching textbox value");
//f1=document.getElementById("topframe");
//alert(f1.src)
theStatus=document.myChoices.AStatus.value
//alert("the audio value is"+theStatus);
document.ContentDCR.EvalScript(theStatus);


}
function AudSwitch()
{
//var theStatus1
//theStatus1=top.frames['topframe'].document.myChoices.AStatus.value;
//alert("got form value from php"+theStatus1);
//g=document.getElementById("main");
//g.src="www.google.com"

//theStatus1=window.frames['topframe'].document.myChoices.AStatus.value
//f = document.getElementById("topframe");

//f.src = "www.netscape.com";


theStatus=document.myChoices.AStatus.value
//alert(theStatus)
if(theStatus=='Aon')
{
document.myChoices.AStatus.value='AOff'
theStatus='AOff';
}
else
{
document.myChoices.AStatus.value='Aon'
theStatus='Aon';
}
//alert(theStatus)
//if(theStatus==null)
//theStatus='Aon'
parent.content.AudSwitch()

}//end function

function audioReplay()
{
//theSoundStatus=parent.topframe.myChoices.AStatus.value


//if(theSoundStatus=='AOff')
//{
//alert("audio is off")
// }
// else
// {
//theStatus='AR'
//document.ContentDCR.EvalScript(theStatus)
//}
parent.content.audioReplay()

}

function showMe()
{
theStatus='SM'
parent.content.showMe()

}

function nextPage()
{
parent.content.nextPage();

}


function prevPage()
{
parent.content.prevPage();

}
</script>

<script language="VBScript">

sub ContentDCR_ExternalEvent(byVal aCommand)

if aCommand = "SendAudStatus()" then
call SendAudStatus()
end if
if aCommand = "goNext()" then
call parent.Instruction.goNext()
end if
if aCommand = "goCorrect()" then
call parent.Instruction.goNextQ("C")
end if
if aCommand = "goIncorrect()" then
call parent.Instruction.goNextQ("I")
end if
end sub

</script>
</head>

<body>
<table width="120" height="30" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#949EB3" bgcolor="#FFFFFF">
<tr bgcolor="#e7f4ff">

<td width="30" height="30" align="center">
<img src="../images/btn_prev.gif" alt="Previous" width="30" height="30" style="cursor:hand" onMouseOver="this.src='../images/btn_prev_h.gif'" border="0" onMouseOut="this.src='../images/btn_prev.gif'" onClick="prevPage()"></td>

<td width="30" height="30" align="center">
<img src="../images/btn_mute.gif" name="changer" alt="Audio on/off" width="23" height="23" style="cursor:hand" onClick="AudSwitch()"></td>

<td width="30" height="30" align="center">
<a href="Moodle Changes helps.doc"><img src="../images/btn_glossary.gif" alt="Glossary" width="30" height="30" border="0" style="cursor:hand" onClick="" onMouseOver="this.src='../images/btn_glossary_h.gif'" onMouseOut="this.src='../images/btn_glossary.gif'"></a></td>

<td width="30" height="30" align="center">
<img src="../images/btn_next.gif" alt="Next" width="30" height="30" style="cursor:hand" onMouseOver="this.src='../images/btn_next_h.gif'" border="0" onMouseOut="this.src='../images/btn_next.gif'" onClick="nextPage()"></td>

</tr>
</table>
</body>
</html>



index.html



<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

<frameset rows="95%,5%" border="0">

<frame name="content" src="M02L01F001.htm" noresize frameborder="no" scrolling="no">

<frame name="footer" src="footer.htm" noresize frameborder="no" scrolling="no">
</frameset>
</HTML>


and finally

M02L01F001.html file is



<html><head><title></title>
<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'>
<style type='text/css'>
<!-- body,td,th {
font-family: Verdana, Arial, Helvetica, sans-serif;font-size: 10px;}
body {
background-color: #1D5081;
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
background-image: url(images/main_bg.gif);
}--> </style>
<script language=JavaScript>
<!--
function SendKey()
{ parent.Navigation.SetKey(event.keyCode)
}//end function
function NoRClkMenu()
{
event.returnValue = false
}//end function
function SendAudStatus()
{
var theStatus
theStatus=parent.footer.myChoices.AStatus.value
document.ContentDCR.EvalScript(theStatus);
}
function AudSwitch()
{
theStatus=parent.footer.myChoices.AStatus.value
document.ContentDCR.EvalScript(theStatus)
}//end function
function audioReplay()
{
theStatus='AR'
document.ContentDCR.EvalScript(theStatus)
}
function showMe()
{
theStatus='SM'
document.ContentDCR.EvalScript(theStatus)
}
function nextPage()
{
document.location.href='M02L02F001.htm'
}
function goNext()
{
document.location.href='M02L02F001.htm'
}
function prevPage()
{
document.location.href='M02L01F002.htm'
}
top.frames[0].SetThisPage(1)
</script>
<script language='VBScript'>
sub ContentDCR_ExternalEvent(byVal aCommand)
if aCommand = "SendAudStatus()" then
call SendAudStatus()
end if
if aCommand = "goNext()"then
call goNext()
end if
if aCommand = "goCorrect()" then
call parent.Instruction.goNextQ("C")
end if
if aCommand = "goIncorrect()"then
call parent.Instruction.goNextQ("I")
end if
end sub
</script></head>
<Body>
<center><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="example" name="example" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="780" height="550">
<param name="movie" value="M02L01F003.swf">
<param id="example" value="example">
<param name="example" value="example">
<param name="quality" value="high">
<embed src="M02L01F003.swf" id="example" name="example" swliveconnect="true" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="780" height="550"></embed>

</object>
</Body></html>






Pls help me it is very urgent..

Thanks in Advance....
Regards,
Sathya