Test for MP3 capabilities using the flash.system.Capabilities.hasMP3 property
package{ import flash.display.Sprite; import flash.system.Capabilities; import flash.net.*; import flash.media.*; public class Main extends Sprite{ public function Main(){
if (flash.system.Capabilities.hasMP3) { var url:URLRequest = new URLRequest("sound.mp3"); var sound:Sound = new Sound(url); sound.play( ); } else { // code to load an external .swf containing a ADCP sound } } } }
Related Scripts with Example Source Code in same category :