title: AVAudioPlayer - must you create a property for it to work? (Xcode)
body: <p>This is the code I'm using now, and it's not working (nothing happens when I press the button that calls this method). Previously, I had a property for audioPlayer and it worked (all the audioPlayers below were self.audioPlayer obviously). The problem was that when I tried to play the sound twice, it would end the first sound playing.</p>
  
  <p>This is no good because I'm making a soundboard and want sounds to be able to overlap. I thought I could just make audioPlayer a local variable instead of a property and all would be ok but now the sound doesn't work at all and I can't figure out why. In all tutorials I've found for AVAudioPlayer, a property is made but no one explains why. If this can't work, what alternatives do I have to make sounds that can overlap?</p>
  
  <pre><code>- (void)loadSound:(NSString *)sound ofType:(NSString *)type withDelegate:(BOOL)delegate {
  NSURL *url = [NSURL fileURLWithPath:[[NSBundle mainBundle]
                                       pathForResource:sound
                                       ofType:type]];
  
  AVAudioPlayer *audioPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:url error:nil];
  if (delegate) audioPlayer.delegate = self;
  [audioPlayer prepareToPlay];
  
  [audioPlayer play];
  }
  </code></pre>