hi… i’ve been experimenting with some buttons in AS3 and sounds… actually the buttons are movie clips and i’m trying to attach a sound to the ROLL_OVER action…
i used this code:
var buttonSound:Sound = new Sound();
var buttonSoundControl:SoundChannel = new SoundChannel();
buttonSound.load(new URLRequest("buttonsound.mp3"));
button_mc.addEventListener(MouseEvent.ROLL_OVER, RollOverListener);
function RollOverListener(e:MouseEvent):void
{
e.currentTarget.gotoAndStop(2)
e.currentTarget.buttonMode = true;
buttonSoundControl = buttonSound.play();
e.currentTarget.addEventListener(MouseEvent.CLICK, ClickListener);
}
so this code works… but it loads the sound externally… and after a few minutes of browsing through the website the roll_over sound becomes laggy… i’m guessing it’s because it loads over and over in the memory when hovering the buttons… btw here is the website so you can try it for yourself:http://www.test.bvbusinessconsulting.ro/
my idea is to attach the sound to the swf file… i know that in AS2 there was a function attachSound() but this one is missing in AS3 and has now equivalent…
so if someone could help me on this one i would be really greateful!!
thanks in advanced!