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

Sound not working in Flash Builder. Help please.

New Here ,
Aug 15, 2013 Aug 15, 2013

Copy link to clipboard

Copied

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!

Views

487

Translate

Translate

Report

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