A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Problems with repeating sound

  1. #1
    Junior Member
    Join Date
    Sep 2008
    Posts
    2

    Problems with repeating sound

    I am trying to make a basic Pac man style game. I have imported the gobble sounds and successfully tied it to the Up arrow keypress. My problem is that if the user hold down the key it plays several instances of the file at the same time and sounds like a Pac man nightmare. How do I set it to only play one instance of the sound at a time and repeat it after the file finishes?

    Thanks

    Cihan

  2. #2
    Senior Member
    Join Date
    Aug 2007
    Posts
    291
    This is just spitballing off the top of my head, so here goes.

    First, I think you can set the sound to loop until stopped. Do that.

    up key code:
    PHP Code:
    if(== 1)
    {
         
    playSound
         
    moveDude;
         
    x=2;
    }
    else
    {
         
    moveDude;

    up key RELEASE code:
    PHP Code:
      stopMove;
      
    stopSound;
      
    x=1
    see how that works for you.

  3. #3
    Senior Member
    Join Date
    Nov 2004
    Posts
    928
    alternatively look into onSoundComplete in the help files

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