AS3.0加载FLV视频的方法及实现代码


复制代码
代码如下:

//打开连接
var nc:NetConnection = new NetConnection();
nc.connect (null);
//提取 flv视频
var ns:NetStream = new NetStream(nc);
ns.play ("laislabonita.flv");
//显示 flv视频
var vid:Video = new Video();
vid.attachNetStream (ns);
addChild (vid);
//处理错误
ns.addEventListener (AsyncErrorEvent.ASYNC_ERROR, asyncErrorHandler);
function asyncErrorHandler (event:AsyncErrorEvent):void
{
// 忽略错误
}
///控制影片暂停/播放
function mouseRelease (event:MouseEvent)
{
ns.togglePause ();
}
pause_btn.addEventListener (MouseEvent.CLICK,mouseRelease);

补充:

复制代码
代码如下:

//onMetaData
var client:Object=new Object();
client.onMetaData = onMetaData;
videoStream.client = client;
function onMetaData(data:Object):void
{
_duration = data.duration;
}

AS3.0加载FLV视频的方法及实现代码

上一篇:painter绘制《龙脉》人物插画教程上篇


下一篇:Photoshop 人物照片偏暗的暖色调