var vc:NetConnection = new NetConnection();
vc.connect(null);
var vs:NetStream = new NetStream(vc);
vs.addEventListener(NetStatusEvent.NET_STATUS ,onStatusEvent);
function onStatusEvent(stat:Object):void {
trace(stat.info.code);
}
var meta:Object = new Object();
meta.onMetaData = function(meta:Object){
trace(meta.duration);
};
vs.client = meta;
var video:Video = new Video(stage.stageWidth, stage.stageHeight);
addChild(video);
video.attachNetStream(vs);
vs.play("flv/myFLV.flv");
//pauseButton is a movieclip in the library that is exported for actionscript with the class name pauseButton
var PauseButton:pauseButton = new pauseButton();
PauseButton.y = stage.stageHeight - PauseButton.height/2;
PauseButton.x = PauseButton.width/2;
PauseButton.addEventListener(MouseEvent.CLICK , PausePlayback);
PauseButton.useHandCursor = true;
function CreatePlay() {
this.addChild(PauseButton);
}
function PausePlayback(e:Event):void {
vs.pause();
}
CreatePlay();