2009. február 17., kedd

Actionscript 3.0 - Video

var nc:NetConnection = new NetConnection();
nc.connect(null);
var ns:NetStream = new NetStream(nc);
ns.play("01.flv");

var myVideo:Video = new Video(320,240);
myVideo.attachNetStream(ns);
addChild(myVideo);

var stop_btn:Stop = new Stop();
var play_btn:Play = new Play();
stop_btn.x = 170;
stop_btn.y = 250;
play_btn.x = 140;
play_btn.y = 250;
addChild(stop_btn);
addChild(play_btn);

stop_btn.addEventListener(MouseEvent.CLICK, stopVid);
play_btn.addEventListener(MouseEvent.CLICK, playVid);

function stopVid(event:MouseEvent):void
{
ns.pause();
}

function playVid(event:MouseEvent):void
{
ns.resume();
}

Nincsenek megjegyzések: