Sound plays an important role in today’s games and applications. On this tutorial we have a extensive introduction to the Sound class in Actionscript and a easy to understand demonstration on how to use it.
CLICK HERE FOR A COMPLETE CARTOON SMART SOUND AND MUSIC TUTORIAL
HERE IS THE SOURCE CODE
//by Avraham Saltoun
// solutions at say-web dot com
//FREE TO USE, COPY and DISTRIBUTE
// As usual we start with an URL request
var req:URLRequest = new URLRequest (“Whoosh_Space_SE.mp3″);
//but unlike before, now we are using the Sound Class
// The Loader class is good for image files such as JPG, PNG, BMP and even SWF files
var sound:Sound = new Sound();
function soundLoaded(event:Event):void {
//The play method will play the MP3 File in the sound class variable
sound.play();
}
// This tells flash to fire the function only after loading is completed
sound.addEventListener(Event.COMPLETE, soundLoaded);
sound.load(req);
// thanks for watching
// I hope it helps !!!






18 Responses to “ActionScript 3.0 Video Lesson 28: How to Load and Play Sound in Flash using the Sound Class”
Trackbacks/Pingbacks