Following up on the guidance above, here are some detailed instructions for embedding sounds using FlashDevelop.
The version of FlashDevelop I’m using (3.0.0 Beta 7) cannot directly import a sound as a library element like the png and fonts mentioned here. However, FlashDevelop can import an swf file that contains the sound. So here are the steps.
1. Find the sound. I needed a click or beep to indicate a button push and so searched the Internet for public domain sounds. I ended up using a sound from this web site http://www.partnersinrhyme.com/soundfx/ … beep.shtml entitled “beep pure”. You may find sounds such as this one in a variety of formats, but they need to be converted to mp3 format with 128kbps encoding.
2. Convert the format using a free audio editing tool called Audacity which you can download from here http://audacity.sourceforge.net/download/windows. You can use this tool to clip out dead space, adjust volume, and many other things. In order for Audacity to produce mp3 format output, you must also download a dll utility called lame. There is a link to lame from the same Audacity web site. The first time you run Audacity and try to export to mp3, you will be asked to locate the lame dll file. Export to mp3 using this lame dll automatically chooses 128kbps. In my case, I exported to a file named BEEPPURE128kbps.mp3
3. You need to use swfmill to create an swf file that contains the sound file. The swfmill program is guided by an XML file. Use a text editor to create an XML file called sounds.xml similar to this:
<?xml version="1.0" encoding="iso-8859-1" ?>
<movie width="320" height="240" framerate="12">
<background color="#ffffff"/>
<frame>
<library>
<sound id="beep2ID" import="BEEPPURE128kbps.mp3"/>
</library>
</frame>
</movie>
Note that the string after “sound id” above will be how you refer to the sound in your ActionScript code and the string after the “import” above is the name of the file you created as an export from Audactiy using lame.
4. Because FlashDevelop uses swfmill, you have probably already downloaded it. I found it in C:\Program Files\FlashDevelop\FirstRun\Tools\swfmill\swfmill.exe. From there run it from a DOS command line like this:
swfmill simple sounds.xml sounds.swf
This should produce the sounds.swf file that you will use in your FlashDevelop project. At this step, I had problems with many sound files where swfmill would complain that the mp3 file referred to in the XML file was invalid. I’m not sure why, but if you are willing to find the swfmill source code, apply patches, and compile it, here is a link to a site that has a patch that purports to fix some of the shortcomings with sound import with swfmill.
http://www.mindless-labs.com/blog/archi … ile_import
I just kept trying until I found a sound file that worked with the existing swfmill.
5. Move the resulting swf file into the folder with your FlashDevelop source. Then within FlashDevelop, find this file name in the panel on the right side. Note that the filename is black. Next right click on the file name and from the pop-up menu, select Add to Library. Then the filename will turn blue.
6. In your ActionScript code, you would put something like the following:
static var _beep2: Sound = new Sound();
static function Main(mainMc:MovieClip){
_beep2.attachSound("beep2ID");
_beep2.setVolume(10); // Because otherwise its too loud
...
// Upon push of a button...
beep2.start();
}
7. Compile and run. The sounds did not work on the Flash player integrated with the FlashDevelop environment, but they worked fine on the Chumby.