ActionScript 3.0 Video Lesson 28: How to Load and Play Sound in Flash using the Sound Class

Mon, Sep 7, 2009

ActionScript


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.

DOWNLOAD THE SOURCE FLA FILE

CLICK HERE FOR A COMPLETE CARTOON SMART SOUND AND MUSIC TUTORIAL

HERE IS THE SOURCE CODE

// Loading Sound in ActionScript 3.0
//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 !!!

Related Articles:

, , , , , , , , , , , , , , , , , ,

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


Trackbacks/Pingbacks

Leave a Reply

You must be logged in to post a comment.

My name is Avraham Saltoun, and I live in Jerusalem, Middle East. I am currently on my mid  40's and I am a computer programming technician. Here you will find over one hundred quality video tutorials on Actionscript, and yes, I give online support for aspiring programmers, and pros as well, sharing screen on skype and delivering source code by email, click the button for live flash actionscript support now!

 
oDesk Certified Action Script Programmer
oDesk Certified Adobe Flash CS3 Designer
oDesk Certified Adobe Photoshop 6.0 Designer
Skype Me™!

$7.49 .Com! Score Savings Cartoon Smart Tutorials


1,260
Unique Visitors
Previous 30 Days
Powered By Google Analytics