2010/04/20 | 载入外部flv文件
类别(as3学习) | 评论(2) | 阅读(131) | 发表于 09:42

以前做过类似工作,好久不用又不记得了,在博客中记录下,希望以后就这个问题不用再查帮助了

 

var connection:NetConnection = new NetConnection();   // 提供NetStream的数据来源
connection.connect(null);

var _stream:NetStream=new NetStream(connection);  //  NetStream负责载入和播放flv文件
_stream.play("test.flv");
var client:Object=new Object();
_stream.client=client;

var _video:Video=new Video(600,450);    //Video对象负责显示视频
_video.attachNetStream(_stream);
addChild(_video);

在时间轴上加上以上代码,并在同目录下放一测试文件test.flv。

8

评论Comments(2条)

Lujy
Lujy
2010/4/20 12:54:58
板凳
...wow...好久没碰Flash了。看着有些陌生了,呵呵
好东西改天研究!先收藏!
牛蛙
牛蛙
2010/4/20 9:52:26
沙发
如果是在类文件中,这要导入相关类:

import flash.display.Sprite;
import flash.net.NetConnection;
import flash.net.NetStream;
import flash.media.Video;
<< 1

发表留言post

用 户Name:
密 码Password:
内 容Comment:
http://www.5d.cn/images/size_down.gif http://www.5d.cn/images/size_up.gif
验 证Verify: