var flvA:Array=["video1.flv","videos.flv","video3.flv"];
var t:Timer=new Timer(5000,1);
t.addEventListener(TimerEvent.TIMER,playvideo);
this.addEventListener(MouseEvent.MOUSE_MOVE,mousem oved);
function mousemoved(e:MouseEvent):void{
t.reset();
t.start();
}
var video:Video = new Video();
addChild(video);
var nc:NetConnection = new NetConnection();
nc.connect(null);
var ns:NetStream = new NetStream(nc);
ns.client = {onMetaData:ns_onMetaData, onCuePoint:ns_onCuePoint};
video.attachNetStream(ns);
function playvideo():void{
this.removeEventListner(MouseEvent.MOUSE_MOVE,mous emoved);
t.removeEventListener(TimerEvent.TIMER,playvideo);
ns.play(flvA[Math.floor(Math.random()*3)]);
}
function ns_onMetaData(item:Object):void {
trace("metaData");
video.width = item.width;
video.height = item.height;
video.x = (stage.stageWidth - video.width) / 2;
video.y = (stage.stageHeight - video.height) / 2;
}
function ns_onCuePoint(item:Object):void {
trace("cuePoint");
trace(item.name + "\t" + item.time);
}