<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="jbInit();">
<mx:Script>
<![CDATA[
import mx.rpc.events.FaultEvent;
import mx.rpc.events.ResultEvent;
import mx.rpc.http.HTTPService;
import mx.controls.Alert;
var sound:Sound;
var chan:SoundChannel;
var so:SharedObject;
function jbInit(){
sound = new Sound();
var reg:URLRequest = new URLRequest("http://antiserver.kuwo.cn/anti.s?format=mp3&rid=MUSIC_4168456&response=res&type=convert_url");
sound.addEventListener(Event.COMPLETE,loadNextSong);
sound.load(reg,new SoundLoaderContext(3000, true));
sound.addEventListener(IOErrorEvent.IO_ERROR,ioMethod);
chan=sound.play(0);
}
public function resu(event:ResultEvent):void{
Alert.show("result");
}
public function fault(event:FaultEvent):void{
Alert.show("fail");
}
public function loadNextSong(event:Event):void{
Alert.show("歌曲播完");
}
public function soundComplete(event:Event):void{
Alert.show("sucee");
}
public function ioMethod(event:IOErrorEvent):void{
Alert.show("Io");
}
]]>
</mx:Script>
</mx:Application>