Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Play sound the first time only

Guest
Feb 10, 2014 Feb 10, 2014

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?   

TOPICS
ActionScript
523
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 10, 2014 Feb 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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Feb 12, 2014 Feb 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. 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 13, 2014 Feb 13, 2014
LATEST

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!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines