用户名: 密码: 验证码: QQ--程序群:31736530 动画群:38836599
闪无忧
 
首 页 业界新闻 业界杂谈 Flash教程 Flash源码 Flash图书 Flash酷站 Flex & AIR 供求信息
   本栏目通告:   有意向写收费精品教程的朋友,请联系本站合作
当前位置 :首页>flash教程>Fms教程>列表

了解下flv播放器的基本功能

[来源:闪吧 | 作者:humorguy | 时间:2008-04-04 | 点击:  | 收藏本文  【 】]
测试的时候在同目录下创建个“flv”文件夹,把要播放的视频文件放到里面,当然,相对应的playlist.xml也要修改一下。
 
//==========视频初始化======================
var nc:NetConnection = new NetConnection();
nc.connect(null);
var ns:NetStream = new NetStream(nc);
my_video.attachVideo(ns);
ns.setBufferTime(5);
//=====从xml文件中获得待播放视频的各种信息====
data_xml = new XML();
data_xml.ignoreWhite = true;
data_xml.onLoad = loadData;
data_xml.load("playlist.xml");
var aPath = new Array();
temp = 0;
function loadData(success) {
if (success) {
  //获得所有的文件名称
  songTitel = new Array();
  audioTracks = this.firstChild.childNodes;
  song_total = audioTracks.length;
  for (var i = 0; i<song_total; i++) {
   aPath.push(audioTracks.attributes.path);
   songTitel.push(audioTracks.attributes.title);
   //=======创建播放列表按钮组========
   filelistG_mc.attachMovie("filelist_mc","filelist_mc"+i,i);
   filelistG_mc["filelist_mc"+i]._y = (i+1)*3 + 20*i;
   filelistG_mc["filelist_mc"+i]._x = 4;
   filelistG_mc["filelist_mc"+i].title_txt.text = songTitel;
   filelistG_mc["filelist_mc"+i].onPress = function() {
    listplay(this.getDepth());//=====给列表上的每个文件定义按钮事件
   };
  }
}
}
//==========构造函数========================
function listplay(path){
temp = path;
test.text = songTitel[path] + " playing..";
playvideo();
}
function playvideo (){
ns.stop();
currentVideo = aPath[temp];
ns.play(currentVideo);
}
//=============播放按钮控制==================
stop_btn.onPress = function(){
ns.seek(0);
ns.pause();
}
pause_btn.onPress = function(){
ns.pause();
}
play_btn.onPress = function(){
  playvideo(path);
}
ns.onMetaData = function(obj) {
dur = obj.duration;
};
_root.onEnterFrame = videoUpdate;
lprog_mc.onPress = function(){
_root.onEnterFrame = scrubba;
}
lprog_mc.onRelease = lprog_mc.onReleaseOutside = function(){
ns.pause(false);
_root.onEnterFrame = videoUpdate;
}
function scrubba (){
var p = ((_root._xmouse - 11)/334.9);
if(_root._xmouse <= 345.9 && p >= 0){
  ns.seek(p*dur);
  ns.pause(true);
  prog_mc._xscale = p*100;
  }
}
function videoUpdate() {
var prog = ns.time/dur;
prog_mc._xscale = prog*100;
playlab_mc._x = 7.5 + prog*334.9;
var lprog = ns.bytesLoaded/ns.bytesTotal;
lprog_mc._xscale = lprog*100;
}
//=========声音控制=============
vidsound.attachAudio(ns);
var sou:Sound = new Sound(vidsound);
sou.setVolume(75);
SC_mc.onPress = function (){
this.onEnterFrame = setV;
}
SC_mc.onRelease = SC_mc.onReleaseOutside = function (){
delete this.onEnterFrame;
}
function setV (){
if(_root._ymouse >= 275 && _root._ymouse <= 336.5){
  var soundP = (61.5 - (_root._ymouse - 275))/61.5;
  sou.setVolume(soundP*100);
  SC_mc._yscale = soundP*100;
  myVolume = sou.getVolume();
  }
}
mute_mc.onRelease = function() {
if (sou.getVolume() == 0) {
  sou.setVolume(myVolume);
  SC_mc._yscale = myVolume;
} else {
  myVolume = sou.getVolume();
  sou.setVolume(0);
  SC_mc._yscale = 1;
}
}


上一页12 下一页
文章如果有错误或者缺少文件,请发邮件提交给我们
上一篇:基于Flash Communication Server构建的多人互动聊天教程
下一篇:让FLVPlayer 组件如何能够识别非flv后缀的视频
Tags:     功能 基本 播放器 了解 function // filelist_mc 文件
>>> 最新评论:(共有 0 位网友发表了评论)      查看所有评论
  发表评论
用户名: 新注册) 密码: 匿名评论
评论内容:(不能超过250字,需审核后才会公布,请自觉遵守互联网相关政策法规。
·本站发布内容均为客观表达作者观点,不代表闪无忧立场,请勿攻击和漫骂
·用户发表意见仅代表其个人意见,并且承担一切因发表内容引起的纠纷和责任
·本站管理人员有权在不通知用户的情况下删除不符合规定的评论信息或留做证据
·请客观的评价您所看到的资讯,提倡就事论事,杜绝漫骂和人身攻击等不文明行为
  教程分类
  基础操作   动画特效
  应用开发   组件学习
  As程序   动画教程
  Flash cs3   AS 3.0
  FCS/FMS教程   Loading教程
  Flash与Web   Flash教程连载
  相关文章
·FMS在线客服系统(客户端篇)
·FMS在线客服系统(fms脚本)
·FMS在线客服系统(分析篇)
·分布式的Flash Media Server: Gr
·基于SharedObject 3*3数组 做的M
·用flex做的 多服务器 im 及 源码
·基于SharedObject做的房间列表和
·fms 2.0A星寻路
·FMS音频延迟分析
·fms中介函数
  热门文章
·Flash进度条的制作详细讲解(组图)
·flash幻灯片网页效果
·Flex 3 AdvancedDataGrid的使用(第二
·全Flash动画网站实现的基础教学
·flash水影效果字
·Flash打造简单的飘雪动画视觉特效
·FLASH+XML相册(附源码)
·超酷flash光晕移动效果
·Flash旋转拖尾文字效果的制作教程
·Flash制作大雪纷飞效果动画
·flash春雷闪电效果
关于我们 - 免责声明 - 网站地图 - 商务服务 - 联系我们 - RSS地图
©CopyRight 2006-2008, 5UFlash.COM, Inc. All Rights Reserved
鲁ICP备06034971号