百科全书

当前位置/ 首页/ 要闻频道/百科全书/ 正文

如何用Flash做进度条(","titletext":"如何用Flash做进度条)

导读 想必现在有很多小伙伴对于如何用Flash做进度条 ","title_text":"如何用Flash做进度条方面的知识都比较想要了解,那么今天小好小编就...

想必现在有很多小伙伴对于如何用Flash做进度条 ","title_text":"如何用Flash做进度条方面的知识都比较想要了解,那么今天小好小编就为大家收集了一些关于如何用Flash做进度条 ","title_text":"如何用Flash做进度条方面的知识分享给大家,希望大家会喜欢哦。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进度条。

本文到此结束,希望对大家有所帮助。

免责声明:本文由用户上传,如有侵权请联系删除!

免责声明:本文由用户上传,如有侵权请联系删除!