自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(0)
  • 资源 (1)
  • 收藏
  • 关注

空空如也

可嵌入网页的flash播放器

//-------------------------------------------------------------------------- // 初始化可能用到的变量 //-------------------------------------------------------------------------- // 设定默认打开就播放的文件名(如果在html中没有设置) // 你可以改变'video.flv' if(!_root.file) { file = 'video.flv' } else { file = _root.file; } // 设定自动播放的flv录像 // 可以使用的值:'true' 或 'false' if(_root.autoStart == 'true') { autoStart = true; } else { autoStart = false; } // 设定flv录像的长和宽(设置成你想要的值都可以) w = Stage.width; h = Stage.height; //-------------------------------------------------------------------------- // 流设置及函数 //-------------------------------------------------------------------------- // 创建并设置网络流 nc = new NetConnection(); nc.connect(null); ns = new NetStream(nc); // 创建并设置声音对像 this.createEmptyMovieClip("snd", 0); snd.attachAudio(ns); audio = new Sound(snd); audio.setVolume(80); // 绑定显示 videoDisplay.attachVideo(ns); // 从网络流中获取时间元素 ns.onMetaData = function(obj) { this.totalTime = obj.duration; }; // 从网络流中获取状态消息 ns.onStatus = function(object) { if(object.code == "NetStream.Play.Stop") { // 影片完成后返回并暂停 ns.seek(0); if(_root.repeat == 'true') { return; } ns.pause(); playBut._visible = true; pauseBut._visible = false; videoDisplay._visible = false; playText.txt.text = "click to play"; } }; //-------------------------------------------------------------------------- // 控制条功能 //-------------------------------------------------------------------------- // 播放影片并隐藏播放按钮 function playMovie() { if(!isStarted) { ns.play(file); playText.txt.text = "loading .."; isStarted = true; } else { ns.pause(); } pauseBut._visible = true; playBut._visible = false; videoDisplay._visible = true; } // 影片暂停并隐藏暂停按钮 function pauseMovie() { ns.pause(); playBut._visible = true; pauseBut._visible = false; }; // 点击影片的动作 videoBg.onPress = function() { if(pauseBut._visible == false) { playMovie(); } else { pauseMovie(); } }; // 点击暂停按钮的动作 pauseBut.onPress = function() { pauseMovie(); }; // 点击播放按钮的动作 playBut.onPress = function() { playMovie(); }; // 影片载入进度 progressBar.onEnterFrame = function() { loaded = this._parent.ns.bytesLoaded; total = this._parent.ns.bytesTotal; if (loaded == total && loaded > 1000) { this.loa._xscale = 100; delete this.onEnterFrame; } else { this.loa._xscale = int(loaded/total*100); } }; // 影片播放进度 progressBar.tme.onEnterFrame = function() { this._xscale = ns.time/ns.totalTime*100; }; // start playhead scrubbing(看不求懂啥意思) progressBar.loa.onPress = function() { this.onEnterFrame = function() { scl = (this._xmouse/this._width)*(this._xscale/100)*(this._xscale/100); if(scl < 0.02) { scl = 0; } ns.seek(scl*ns.totalTime); }; }; // stop playhead scrubbing(看不求懂啥意思) progressBar.loa.onRelease = progressBar.loa.onReleaseOutside = function () { delete this.onEnterFrame; pauseBut._visible == false ? videoDisplay.pause() : null; }; // volume scrubbing(看不求懂啥意思) volumeBar.back.onPress = function() { this.onEnterFrame = function() { var xm = this._xmouse; if(xm>=0 && xm <= 20) { this._parent.mask._width = this._xmouse; this._parent._parent.audio.setVolume(this._xmouse*5); } }; } volumeBar.back.onRelease = volumeBar.back.onReleaseOutside = function() { delete this.onEnterFrame; } //-------------------------------------------------------------------------- // 调整大小并定位所有项目 //-------------------------------------------------------------------------- function setDims(w,h) { // 设置显示尺寸 videoDisplay._width = videoBg._width = w; videoDisplay._height = videoBg._height = h-20; playText._x = w/2-120; playText._y = h/2-20; // 调整项目到左边 .. playBut._y = pauseBut._y = progressBar._y = volumeBar._y = h-20; progressBar._width = w-56; volumeBar._x = w-38; } // 这儿你不用考虑影片的尺寸 setDims(w,h); //-------------------------------------------------------------------------- // 就这些了,开始播放影片 //-------------------------------------------------------------------------- // 开始播放影片 // 如果没有自动开始播放,它将搜索jpg图片,并隐藏暂停按钮 pauseBut._visible = false; if(_root.image) { imageStr = _root.image; } else { imageStr = substring(file,0,file.length-3)+"jpg"; } imageClip.loadMovie(imageStr); if (autoStart == true) { playMovie(); }

2010-08-15

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除