A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Play sound only once

  1. #1
    Junior Member
    Join Date
    Dec 2011
    Location
    India
    Posts
    28

    Play sound only once

    Hey everyone!

    I put a sound starting from frame 1 to the last frame.
    In my code I have 2 gotoAndStop() functions
    one goes to frame 1 again.
    When that happens the sound plays again, so the sound now plays twice. How can I fix it so that that wont happen and the sound only plays once even when going to frame 1 again...

    thanks!

  2. #2
    Senior Member
    Join Date
    Jun 2008
    Posts
    549
    Try something like this. Put the code in your first frame and add your sound code as shown.

    var played:Boolean = false;

    if(!played){
    played = true;

    //add your sound code here
    }

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center