actionscript 3 - sound started over and over, causing game to crash -


currently have game in try play sound when ever player presses arrow key moves car handled enter-frame function, ends happening sound started again on , on , playing on each other long key held down crashing game. below code using play/stop sound code enter-frame function (animate).

function sounds(): void {     if (forwardpressed == true)     {         carmovesound.play(pausepos);         trace('play sound');         return;     }      if (forwardpressed == false)     {         soundmixer.stopall();         trace('stop sound');         return;     } }  function animate(e: event) {     movecar();     checkhitboundry();     checkhitobstacle();     checklapfinish();     sounds();      if (gameover)     {         endgame();         return;     } } 

any appreciated.


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -