Upon button press how can play a sound at EXACT same time as screen activity
<p>I have a very specific issue and I have not yet found a solution.
I have an IBAction for a button press. What I want to happen when this button is pressed is:</p>

<ol>
<li><p>play a sound file (this is about 5 seconds long sound)</p></li>
<li><p>flash words on the screen (this is also about 5 seconds long)</p></li>
</ol>

<p>I want this to happen concurrently so total time is about 5 seconds (words flashing while sound is playing). </p>

<p>What I end up with is that the words flash first, then the sound plays.  I can never get them to go concurrently.  Interestingly also I can never get the sound to play first even when placed at the very start of the action.</p>

<p>I've tried NSThread the sound, exec, CATransaction flush, but nothing can get them concurrent.</p>

<p>any ideas, btw I am total beginner programmer so sorry if not described the proper way.</p>

<pre><code>-(IBAction) playButtonClick:(id)sender {
   int i;

    [_audioPlayer play];

    for (i=0; i&lt;10; i++){
      [self.model getNextWord];   
      [self displayWord];
      [CATransaction flush];
      usleep(550000);   // word on screen for 0.55 seconds
    }

}
</code></pre>

<p>[CATransaction flush] is required else all I would see would be the very last word.</p>