flash on 2011-10-6
♥0 |
Line 34 |
Modified 2011-10-06 07:27:18 |
MIT License
archived:2017-03-20 19:25:29
ActionScript3 source code
/**
* Copyright rfkrocktk ( http://wonderfl.net/user/rfkrocktk )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/A8wk
*/
package {
import flash.events.SecurityErrorEvent;
import flash.events.IOErrorEvent;
import flash.events.Event;
import flash.events.MouseEvent;
import flash.media.Sound;
import flash.net.URLRequest;
import flash.display.Sprite;
public class FlashTest extends Sprite {
private var request:URLRequest;
private var sound:Sound;
public function FlashTest() {
this.request = new URLRequest("http://s6.voscast.com:7158/;stream.mp3");
this.sound = new Sound(this.request);
this.sound.addEventListener(Event.ID3, onID3);
this.sound.addEventListener(IOErrorEvent.IO_ERROR, function(e:IOErrorEvent):void {
trace("io error");
});
this.sound.addEventListener(SecurityErrorEvent.SECURITY_ERROR, function(e:SecurityErrorEvent):void {
trace("security error");
});
this.sound.play();
this.stage.addEventListener(MouseEvent.CLICK, function(e:MouseEvent):void {
try {
sound.close();
} catch (e:Error) {
}
});
}
private function onID3(e:Event):void {
trace(this.sound.id3.songName);
}
}
}