Skip to main content
February 10, 2014
Question

Play sound the first time only

  • February 10, 2014
  • 1 reply
  • 565 views

Hello

I have an As3 simple game with navigation buttons. It starts off with short intro with sound. When the game loads and the player dies it goes to retry screen with button which when is pressed goes back to the game. The problem is that when that happens flash plays the music from the short intro when returning to the game. How Do I stop this from happening. Currently I have no code for the sound. I just added the music directly to the frame with the intro and that's it. So what code do I write for the sound to execute only once?   

This topic has been closed for replies.

1 reply

sinious
Legend
February 10, 2014

Either stretch the music layer out to the entire main timeline and configure that layer to loop only 1 time (thus returning to frame 1 doesn't "change a keyframe"), do not return back to frame 1, or use code to play the sound. If the latter is the choice then there is no shortage of examples of how to play:

http://help.adobe.com/en_US/as3/dev/WS5b3ccc516d4fbf351e63e3d118a9b90204-7d21.html

February 12, 2014

Thank you very much for your answer I figured it out. It was confusing to me because always talks about URL's in the examples and my sound was inside the project. 

sinious
Legend
February 13, 2014

Glad you got back to progress. If you're all set please mark a correct answer so we can filter unanswered questions.

You're welcome and good luck!