I have a really annoying problem which i have been trying to fix for a long time. I have 3 scenes. On scene one i have this music AS on the first frame.
MenuMusic = new Sound(MenuMusic);
MenuMusic.attachSound("MenuMusic");
MenuMusicVolume = 100;
MenuMusic.setVolume(MenuMusicVolume);
MenuMusic.start("MenuMusic",999);
It all works great.
I then have this AS towards the end of the scene.
this.onEnterFrame = function() {
MenuMusic.setVolume(MenuMusicVolume);
MenuMusicVolume = MenuMusicVolume-2;
if (MenuMusicVolume<2) {
MenuMusic.stop("MenuMusic");
}
}
It fades out like it should but then this happens...
I added this AS to the start of the next scene.
BossExplain = new Sound(BossExplain);
BossExplain.attachSound("BossExplain");
BossExplainVolume = 100;
BossExplain.setVolume(BossExplainVolume)
;
BossExplain.start(0, 999);
this.onEnterFrame = function() {
MenuMusicVolume = 100;
};
The thing is. The music starts out fine and gets louder and louder until the speakers are screaming.
I understand how it happens due to the fact that the previous music got quieter and quieter until it got into minus number meaning it would go louder again, but 2 things.
1. Why would each piece of music share the same volume name (MenuMusicVolume).
2. I stopped the last piece of music anyway so why would should the new song get louder.
Note: It also does this to every piece of sound after the menu song.
Please help. Thank you for reading.