Can't mute/unmute swf audio using Flash Command action
November 21, 2012 12:00 AM
Please help me figure out why Lectora won't mute/unmute a swf I created with the following AS3. I've tested this code and it will mute/unmute the audio when called within the swf itself:
var st:SoundTransform = SoundMixer.soundTransform;
var muteFlashAudio = "0";
addEventListener(Event.ENTER_FRAME, toggleAudio);
function toggleAudio(event:Event) {
if (muteFlashAudio == "1"){ //if mute toggled on, zero volume
st.volume = 0;
SoundMixer.soundTransform = st;
}
else if (muteFlashAudio == "0"){ //else audio at full volume
st.volume = 1;
SoundMixer.soundTransform = st;
}
}[/CODE]
However in Lectora nothing happens when a button is clicked with the following action:
On: Mouse Click
Action: Flash Command
Target: (my swf)
Command: Set Variable
Name: muteFlashAudio
Value: 1
Originally I tried using "Call Function", but I read on the forums that is unreliable. So I switched to "Set Variable" and adjusted the code (still works as a stand alone swf). Other Flash commands work on the swf (pause/play, etc). Of course, I am testing after publishing to HTML. This doesn't work in any browser I try.
What am I missing?[CODE]var st:SoundTransform = SoundMixer.soundTransform;
var muteFlashAudio = "0";
addEventListener(Event.ENTER_FRAME, toggleAudio);
function toggleAudio(event:Event) {
if (muteFlashAudio == "1"){ //if mute toggled on, zero volume
st.volume = 0;
SoundMixer.soundTransform = st;
}
else if (muteFlashAudio == "0"){ //else audio at full volume
st.volume = 1;
SoundMixer.soundTransform = st;
}
}[/CODE]
However in Lectora nothing happens when a button is clicked with the following action:
On: Mouse Click
Action: Flash Command
Target: (my swf)
Command: Set Variable
Name: muteFlashAudio
Value: 1
Originally I tried using "Call Function", but I read on the forums that is unreliable. So I switched to "Set Variable" and adjusted the code (still works as a stand alone swf). Other Flash commands work on the swf (pause/play, etc). Of course, I am testing after publishing to HTML. This doesn't work in any browser I try.
What am I missing?
Discussions have been disabled for this post