Quantcast
Channel: Adobe Community : Discussion List - Using Flash Builder
Viewing all articles
Browse latest Browse all 1802

Sound not working in Flash Builder. Help please.

$
0
0

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")]

 

          publicclass SoundThing extends Sprite

          {

 

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

                    privatevar Try:Class;

 

                    privatevar _try:Sound = new Try();

                    privatevar _tryChannel:SoundChannel = new SoundChannel();

 

                    publicfunction SoundThing()

                    {

                              stage.addEventListener

                                        (KeyboardEvent.KEY_DOWN, keyDownHandler);

                    }

 

                    publicfunction 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!


Viewing all articles
Browse latest Browse all 1802

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>