论坛交流
首页办公自动化| 网页制作| 平面设计| 动画制作| 数据库开发| 程序设计| 全部视频教程
应用视频: Windows | Word2007 | Excel2007 | PowerPoint2007 | Dreamweaver 8 | Fireworks 8 | Flash 8 | Photoshop cs | CorelDraw 12
编程视频: C语言视频教程 | HTML | Div+Css布局 | Javascript | Access数据库 | Asp | Sql Server数据库Asp.net  | Flash AS
当前位置 > 文字教程 > Flash AS编程教程
Tag:2.0,3.0菜鸟,游戏,,cs,技巧,源码,,文本,文字,函数,音乐,随机,拖拽,asp,access,xml,mc,视频教程

简单的Flash进度条制作 (as2.0)

文章类别:Flash AS编程 | 发表日期:2008-10-6 17:43:00


var myLoading:MovieClip;
var loadInfo:MovieClip;
var _lineBgcolor = "0x666666";
var _lineColor = "0x0000FF";
var _lineLen:Number = 200;
var _lineH:Number = 3;
var _txtColor; var _txtAlign:String = "center";
var tb:Number;
var txtFormat:TextFormat = new TextFormat
("Arial", null, 0x000000, true); myLoading = _root.createEmptyMovieClip("myLoading",10); //进度条
loadInfo = myLoading.createEmptyMovieClip("line", 10);
loadInfo.lineStyle(1, _lineColor, 20);
loadInfo.moveTo(0, 0);
loadInfo.lineTo(_lineLen, 0);
loadInfo.lineTo(_lineLen, _lineH);
loadInfo.lineTo(0, _lineH);
loadInfo.lineTo(0, 0); //进度显示文本
loadInfo.createTextField("txt", 30, 0, 0, _lineLen, 22);
loadInfo.txt.autoSize = _txtAlign; //设置进度条的位置(居中于主场景)
loadInfo._x = (Stage.width - _lineLen)/2;
loadInfo._y = Stage.height/2; //获得影片大小并stop,再onEnterFrame
tb = _root.getBytesTotal();
_root.stop();
myLoading.onEnterFrame = function(){
  var lb:Number = _root.getBytesLoaded();
  var percent:Number = Math.round(lb/tb*100);
  loadInfo.txt.text = percent+"%";
  loadInfo.txt.setTextFormat(txtFormat); 
  loadInfo.lineStyle(_lineH, _lineBgcolor, 10);
  loadInfo.moveTo(0, _lineH/2);
  loadInfo.lineTo(percent*_lineLen/100, _lineH/2); 
  if (percent == 100) {
   _root.play();
   delete this.onEnterFrame;
   loadInfo.clear(); 
   loadInfo.txt.text = "";
  }
}
视频教程列表
文章教程搜索
 
Flash AS推荐教程
Flash AS热门教程
看全部视频教程
购买方式/价格
购买视频教程: 咨询客服
tel:15972130058