- Right click and save this MP3 as small_sample.mp3 in the src directory. On my machine, the full path is:
/home/kca/workspace/hello_world/src/ - Copy and paste this XML into asset.xml in the src directory
- At the command prompt, run this command in the src directory:
swfmill simple asset.xml asset.swf
- This will rebuild the asset library. A new SWF file should now exist in the src directory called asset.swf.
- Double click source file Application.as to edit
- At the bottom of function init, add this code:
var snd:Sound = new Sound() ;
snd.attachSound("asset_small_sample") ;
snd.start() ; - Save the file, and the SWF file is automatically rebuilt by Eclipse. Click to hear the MP3 play after the preloader finishes.
Thursday, May 22, 2008
Sound Assets
There are two ways to play sounds in ActionScript: via assets and via streams. This entry will demonstrate how to create and play sound assets.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment