Return to Kroll Design home page

Flash Tutorials (with .FLA files included)

 
« Return

ActionScript 3

Play sound using external files

This is another example that plays an MP3 file which is not embedded in the Flash file, but which is stored in an external folder on the server. The ActionScript is in an external class file of type .AS.

Download the .FLA file

Download the .AS file

The .FLA file has no code. Its Class in the Properties window for the .FLA specifies the .AS file name of PlayExternalSound. Here's the code in the class file:

package {
import flash.display.Sprite;
import flash.media.Sound;
import flash.net.URLRequest;
public class PlayExternalSound extends Sprite {
	public function PlayExternalSound() {
	var note1:Sound = new Sound();
	var note1_mp3:URLRequest = new URLRequest('movies/sounds/scale/note1.mp3');
	note1.load(note1_mp3);
	note1.play();
	} // end of function PlayExternalSound
} // end of class PlayExternalSound
} // end of package


 
« Return


©2012 Kroll Design    info@KrollDesign.net    781.910.3694
Last modified: 12/31/1969 7:00 PM