title: Help stopping audio using AVAudioPlayer
body: <p>Alright I have two problems.  I'm using AVAudioPlayer to play a simple audio file in .caf format.  What I'm trying to do is have a play and pause button.  Here is a sample of a simple IBAction to play the audio from a button.</p>
  
  <pre><code>- (IBAction) clear {
  NSString *path = [[NSBundle mainBundle] pathForResource:@"clear" ofType:@"caf"];
  AVAudioPlayer* myAudio=[[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:path] error:NULL];
  myAudio.delegate = self;
  myAudio.volume = 1.0;
  myAudio.numberOfLoops = 0;
  [myAudio play]; 
  }
  </code></pre>
  
  <p>So when I go ahead and create another IBAction with the method...</p>
  
  <pre><code>- (IBAction) stopaudio {
  [myAudio stop];
  audioPlayer.currentTime = 0;
  }
  </code></pre>
  
  <p>I compile and xcode tells me that myAudio in the stopaudio IBAction is not defined.  How do I fix it so I'm able to access myAudio in another IBAction?</p>
  
  <p>My Second question is that I'm using NavigationController to setup a TableView, when I make a selection it takes me to a UIView with a back button to go back to the TableView.  What I'm trying to do is to kill any audio that I have playing in the UIView when I go back to the TableView.  The code above is part of the code that I'm going to have in the UIView.</p>
  
  <p>Also one quick question. Lets say I have an audio file that is 1 minute long.  Clicking play again will overlap a new instance of that audio before the old instance is done playing.  How can I check to see if myAudio is playing and not allow it to be played again until myAudio is finished playing?</p>
  
  <p>Thank You!</p>