I have a class based MP3 player that loads the file completely before it begins to play. That could be ok but if the movieclip changes to another page then that file will still load and begin to play after the music player is no longer up. This is driving me crazy and I just cannot find a way to get around it. My site is one flash movieclip so there are no SWFs coming in and out… just one. Here is a brief slice from my SoundLoader class file:
public function SoundLoader(songs:Array, player:Mp3Player)
{
songList = songs;
musicPlayer = player;
soundReq = new URLRequest(songList[songIndex]);
loader.load(soundReq);
loader.addEventListener(Event.COMPLETE, songLoaded)
loader.addEventListener(Event.ID3, id3Ready);
}
private function songLoaded(event:Event):void
{
songLength = loader.length;
resumeTime = 0;
song = loader.play();
song.stop();
song.addEventListener(Event.SOUND_COMPLETE, soundFinished);
if(isPlaying)
{
song = loader.play();
}
if(!initialized)
{
songVolume = song.soundTransform;
initialized = true;
musicPlayer.playPause = new PlayPauseButton(musicPlayer.playBtn, musicPlayer.pauseBtn, musicPlayer);
musicPlayer.skipButtons = new SkipButtons(musicPlayer.nextButton, musicPlayer.prevButton, musicPlayer);
musicPlayer.volControl = new VolumeControl(musicPlayer.volBar, musicPlayer);
musicPlayer.progSlider = new ProgressSlider(musicPlayer.progBar, musicPlayer.dragSlider, musicPlayer);
}
else
{
song.soundTransform = songVolume;
}
}
Any help is greatly appreciated. Thank you!