在ActionScript 2中播放FLV [英] Play FLV in ActionScript 2

查看:302
本文介绍了在ActionScript 2中播放FLV的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对Flash和ActionScript很新颖。我正试图简单地播放一个FLV文件。我有以下内容:

  import flash.MovieClip; 
导入flash.Video;
导入flash.NetConnection;
导入flash.NetStream;


class程序{
private var container_mc:MovieClip;
private var video_mc:Video;

$ b 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(完成);

public static function main()
{
new Program();




$ b我得到了完成跟踪消息,但没有视频回放。我简单的在浏览器窗口中有一个黑盒子。有人可以帮我吗?非常感谢!



-

解决方案

以确保在库中有两个动画片段,它们包含您要附加​​的链接ID。



您需要两个:

  VideoContainer 
VideoClip


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

解决方案

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:

VideoContainer
VideoClip

这篇关于在ActionScript 2中播放FLV的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆