var videoConnection:NetConnection = new NetConnection();
videoConnection.connect(null);
var videoStream:NetStream = new NetStream(videoConnection);
videoStream.play("YouTube - Teenage Dream & Just the way you are - Acapella Cover - Katy Perry - Bruno Mars - Mike Tompkins.flv");
var metaListener:Object = new Object();
metaListener.onMetaData = onMetaData;
videoStream.client = metaListener;
var video:Video = new Video();
video.attachNetStream(videoStream);
addChild(video);
video.visible=false;
video.width =280.0
video.height=200.0
video.x=150
video.y=90
function onMetaData(data:Object):void
{
play_btn.addEventListener(MouseEvent.CLICK, playmovie);
pause_btn.addEventListener(MouseEvent.CLICK, pausemovie);
stop_btn.addEventListener(MouseEvent.CLICK, stopmovie);
hide_btn.addEventListener(MouseEvent.CLICK, hidemovie);
}
function playmovie(e:MouseEvent):void
{
video.visible=true
videoStream.resume();
}
function pausemovie(e:MouseEvent):void
{
videoStream.resume();
videoStream.pause();
}
function stopmovie(e:MouseEvent):void
{
videoStream.pause();
videoStream.seek(0);
}
function hidemovie(e:MouseEvent):void
{
video.visible=false
}