Skip navigation
Currently Being Moderated

Sound not working in Flash Builder. Help please.

Aug 15, 2013 3:47 PM

Tags: #help #error #flash #sound #actionscript #builder #game

So, here's my situation. I keep trying to put an mp3 in Flash Builder to try and make sounds happen, but each time I do it only plays the beginning of it and stops midway through. My music is working at 44100 Hz with a 32 bit rate (tried changing it to 16, but Audition won't let me). Here's my code.

 

package

{

 

          import flash.display.Sprite;

          import flash.events.Event;

          import flash.events.KeyboardEvent;

          import flash.media.Sound;

          import flash.media.SoundChannel;

          import flash.ui.Keyboard;

 

          [SWF(width = "550", height = "400",

          backgroundColor = "#FFFFFF", frameRate = "60")]

 

          public class SoundThing extends Sprite

          {

 

                    [Embed(source="../sounds/try1.mp3")]

                    private var Try:Class;

 

                    private var _try:Sound = new Try();

                    private var _tryChannel:SoundChannel = new SoundChannel();

 

                    public function SoundThing()

                    {

                              stage.addEventListener

                                        (KeyboardEvent.KEY_DOWN, keyDownHandler);

                    }

 

                    public function keyDownHandler(event:KeyboardEvent): void

                    {

                              if (event.keyCode == Keyboard.SPACE)

                              {

                                        _tryChannel = _try.play();

                              }

                    }

          }

}

 

I'm not sure what the issue is. Please help me. Thank you!

 

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points