*Please remove, made a better post* Background Music and menus....
Hey!
Im making this iPhone game.
Im using the AVAudioPlayer to play music in the background on the main menu.
But the issue is, when ever I go to load up a different view (Like: About, Options. I want the main menu music still playing on these views), and go back to the main menu, the track that is currently playing will still play, but then another one plays on top of it. The music code is in a custom method which is called by viewDidLoad.
How do I stop it from doing this (let me rephrase this) How do I do it properly??
I have tried using the method applicationDidFinishLoading (I used it in the AppDelegate) to call the -(void) playMusic custom function in my main menu view controller. and it works just fine, but when I go to the start game view (which is where the game takes place) it cannot stop the music that is playing (I use: [ProjectNameViewController stopMusic] "stopMusic" is a method that stops the music from playing. The reason why I want the music to stop is because I want the track to restart when the game starts).
The views are loaded like this:
BlahBlahViewController * blahOne = [[BlahBlahViewController alloc] initWithNibName:@"BlahBlahViewController" bundle:[NSBundle mainBundle]];
[self.view addSubview:blahOne.view];
I know its not ideal, but how else can I do it?
Thanks!
Last edited by Chizbang; 02-01-2012 at 10:44 AM.
|