在 ActionScript 2 中播放 FLV
我对 Flash 和 Actionscript 非常陌生。我正在尝试简单地播放 FLV 文件。我有以下情况:
import flash.MovieClip;
import flash.Video;
import flash.NetConnection;
import flash.NetStream;
class Program {
private var container_mc : MovieClip;
private var video_mc : Video;
public function new() {
var mc : flash.MovieClip = flash.Lib.current;
container_mc = flash.Lib._root.attachMovie("VideoContainer", "container_mc", 0);
container_mc.attachMovie("VideoClip", "video_mc", 1);
var my_nc:NetConnection = new NetConnection();
my_nc.connect(null);
trace(my_nc.isConnected);
var my_ns:NetStream = new NetStream(my_nc);
//my_ns.setBufferTime(1);
container_mc.video_mc.attachVideo(my_ns);
my_ns.play("default.flv");
trace("Done");
}
public static function main()
{
new Program();
}
}
我收到“完成”跟踪消息,但没有视频播放。我只是在浏览器窗口中有一个黑框。有人可以帮我吗?非常感谢!
-缺口
I am very new to Flash and Actionscript. I am trying to simply play an FLV file. I have the following:
import flash.MovieClip;
import flash.Video;
import flash.NetConnection;
import flash.NetStream;
class Program {
private var container_mc : MovieClip;
private var video_mc : Video;
public function new() {
var mc : flash.MovieClip = flash.Lib.current;
container_mc = flash.Lib._root.attachMovie("VideoContainer", "container_mc", 0);
container_mc.attachMovie("VideoClip", "video_mc", 1);
var my_nc:NetConnection = new NetConnection();
my_nc.connect(null);
trace(my_nc.isConnected);
var my_ns:NetStream = new NetStream(my_nc);
//my_ns.setBufferTime(1);
container_mc.video_mc.attachVideo(my_ns);
my_ns.play("default.flv");
trace("Done");
}
public static function main()
{
new Program();
}
}
I get the "Done" trace message back but no video playback. I simple have a black box in the browser window. Can someone help me out? Thanks a ton!
-Nick
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您应该仔细检查以确保库中有两个影片剪辑具有您要附加的链接 ID。
您将需要两者:
You should double check to make sure you have two movieclips in the library that have the linkage IDs that you're trying to attach.
You'll need both:
new 是一个关键字,所以你不能将它用作函数名!
new is a keyword, so you can't use it as a function name!!
我希望..下面的代码..将..工作得很好..
我使用下面的..preBuildCommand..到我的项目中..FAG EXPLORER FLV.fdp
“library/video.swf”
待续
FAG = FREE学术游戏
行时
当我使用“library/video.swf”
,
项目必须包含以下行
观察:
swfmill.exe .. 创建 .. 文件 .. video.swf .. 到目录 .. Library
(library . .. 放置在项目文件旁边)
swfmill.exe 使用文件 .. video.xml .. 创建 .. 文件 .. video.swf
文件 .. video.swf .. 的代码
是继续
/**
* 初始代码来自 http://www.flashdevelop.org/community/viewtopic .php?t=321
* 第 3 部分. 流式传输 FLV 视频(仅限 FlashDevelop/SWFMILL)
*/
I hope that .. the code bellow .. will .. work very well ..
I use the fallowing .. preBuildCommand .. into my project .. FAG EXPLORER FLV.fdp
"library/video.swf"
To be continued
FAG = FREE ACADEMIC GAMES
When I use the line
"library/video.swf"
then
the project must contain the lines below
Observations:
swfmill.exe .. creates .. the file .. video.swf .. into the directory .. library
(library .. is .. placed next to the project file)
swfmill.exe uses the file .. video.xml .. to create .. the file .. video.swf
The code of the file .. video.swf .. is
To be continued
/**
* The initial code is from http://www.flashdevelop.org/community/viewtopic.php?t=321
* Part 3. Streaming FLV videos (FlashDevelop/SWFMILL only)
*/