Can't mute/unmute swf audio using Flash Command action

jsuarez
Community Member Posts: 15
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?
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?
Categories
- 35.9K All Categories
- 109 ✫ Announcements
- 33.1K Lectora®
- 31.1K Lectora Discussions
- 29K Lectora Desktop
- 2K Lectora Online
- 2K Lectora Feature Requests
- 71 Lectora User Groups
- 36 Lectora Accessibility User Group (LAUG)
- 25 ELB Learning Content
- 25 ELB Learning Content Discussions
- 329 CenarioVR®
- 196 CenarioVR Discussions
- 133 CenarioVR Feature Requests
- 42 Rockstar Learning Platform®
- 39 Rockstar Learning Platform Discussions
- 108 CourseMill®
- 108 CourseMill Discussions
- 47 ReviewLink®
- 47 ReviewLink Discussions
- 7 The Training Arcade®
- 7 The Training Arcade Discussions
- 936 All Things eLearning
- 37 eLearning Development
- 546 Learning Management System (LMS) Integration
- 333 Web Accessibility
- 1.2K ♪ The Green Room
- 9 Additional Learning Products