[RESOLVED] Play random flv videos
Hi,
I want to play random videos after 10 seconds if the mouse has not been moved.
I am getting this error:
Quote:
Error #1063: Argument count mismatch on video_fla::img_1/playvideo(). Expected 0, got 1.
at flash.utils::Timer/_timerDispatch()
at flash.utils::Timer/tick()
Here is the code:
Quote:
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);
}
any ideas why I am getting the error?
thanks