Hi, I'm trying to set up a .flv file that will have buttons for two different pieces of sound. I've been able to get the first piece to load and to play and stop, but when I try to load the second piece, I trip up. I'm still a novice, but do think I understand the basic problem -- Actionscript can't distinguish between one sound request and another. The question is, how to fix this and get actionscript to understand that I'm trying to load and play two different sounds associated with two different buttons? I get error codes such as "1151: A conflict exists with definition s in namespace internal." , "duplicate function" problems and "duplicate variable" warnings. I've seen some discussion on this site of a recyclable sound object. I think I'm asking a similar question, but although the person who posed that question also posted a solution, I haven't been able to make it work. Here's the code:
var s:Sound = new Sound();
s.load(new URLRequest("http://www.website.com/Water.mp3"));
wellsplay_btn.addEventListener(MouseEvent.CLICK,playSound);
wellsstop_btn.addEventListener(MouseEvent.CLICK,stopSound);
function playSound(e:MouseEvent):void
{
sc = s.play();
}
function stopSound(e:MouseEvent):void
{
sc.stop();
}
var s:Sound = new Sound();
s.load(new URLRequest("http://www.website.com/Wells.mp3"));
wellsplay_btn.addEventListener(MouseEvent.CLICK,playSound);
wellsstop_btn.addEventListener(MouseEvent.CLICK,stopSound);
function playSound(e:MouseEvent):void
{
sc = s.play();
}
function stopSound(e:MouseEvent):void
{
sc.stop();
}
The rest of the commands work fine. It's only this section that I'm having trouble with. Thanks in advance for any suggestions.