为了向您发送作为标签的行尾,我使用来自w3schools的 HTML 符号实体
取自项目的示例如下:
< asset path="library\video.swf" />
上面的行显示有一个名为 library 的目录,其中包含该文件video.swf
此外,目录库中还有文件video.xml。该文件包含行
<xml version="1.0" encoding="utf-8" >
<movie version="7">
<frame>
<library>
<clip id="VideoDisplay">
<frame>
<video id="VideoSurface" width="160" height="120" />
<place id="VideoSurface" name="video" />
</frame>
</clip>
</library>
</frame>
</movie>
很久以前,我儿子 Alex 从网上下载了 VideoDisplay 类的代码和目录库
我已经改进了 VideoDisplay 类的代码。
通过写 2 个成员
public function pos():Number
{
return ns.time;
}
public function close():Void
{
return ns.close();
}
我创建的程序不仅仅是.flv
文件的浏览器和呈现器
它也是每个.flv
文件所选片段的浏览器和呈现器
现在 VideoDisplay 类的代码是:
class util.VideoDisplay
{
//{ PUBLIC MEMBERS
/**
* Create a new video display surface
*/
function VideoDisplay(targetURI:String, parent:MovieClip, name:String, depth:Number, initObj)
{
display = parent.attachMovie("VideoDisplay", name, depth, initObj);
// create video stream
nc = new NetConnection();
nc.connect(targetURI);
ns = new NetStream(nc);
// attach the video stream to the video object
display.video.attachVideo(ns);
}
/**
* Video surface dimensions
*/
function setSize(width:Number, heigth:Number):Void
{
display.video._width = width;
display.video._height = heigth;
}
/**
* Video clip position
*/
function setLocation(x:Number, y:Number):Void
{
display._x = x;
display._y = y;
}
/**
* Start streaming
* @param url FLV file
* @param bufferTime Buffer size (optional)
*/
public function play(url:String, bufferTime:Number):Void
{
if (bufferTime != undefined) ns.setBufferTime(bufferTime);
ns.play(url);
}
/**
* Pause streaming
*/
public function pause():Void
{
ns.pause();
}
/**
* Seek position in video
*/
public function seek(offset:Number):Void
{
ns.seek(offset);
}
/**
* Get position in video
*/
public function pos():Number
{
return ns.time;
}
public function close():Void
{
return ns.close();
}
//}
//{ PRIVATE MEMBERS
private var display:MovieClip;
private var nc:NetConnection;
private var ns:NetStream;
//}
}