-
Need sound help urgently
Hello everyone,
I am very new to flash and actionscript and don't know a lot about it so I will post my question here. I have been looking for an answer to this but everything I find is not what I need and I find very complicated. What I need help with is this: I have multiple .mp3 files and I want to make them play in my game I made. The game is very basic and is just a choose your own adventure game.
I have lots of different scenes, with layers on all of them and my game runs perfectly. What I am in need of is help making music play at the start of each scene, and stop by the end of it.
Like I said earlier all the code I find is very complicated and I cant follow it easily so is there anyone who can tell me step by step (as basically as possible) how to do this?
I think what I want is some code so that when the scene starts, the music I designate should play, but I need to turn that music off before the next scene so they dont play at the same time.
Any help would be greatly appreciated!
Regards,
Mark.
-
You first have to import the music into your library and give it a class name of Drum or such
function playSound(event:Event):void {
var drum:Drum = new Drum();
var mainSound:SoundChannel = drum.play(0,int.MAX_VALUE);
}
playMusic.addEventListener(MouseEvent.CLICK,playSo und);
playMusic is a button. Then at the end of the scene put the code drum.stop();
This should work :)
-
thanks i was also looking for such script. it realy works