如何制作Flash动画的Loading?
看了网上的Loading的制作教程,一头雾水.
比如说"一般的做法是先将loading做成一个MC,在场景的最后位置设置标签如end,通过ifFrameLoaded来判断是否已经下载完毕,如果已经下载完毕则通过gotoAndPlay控制整个Flash的播放"
"以一个Loading文件为例,在场景里加入插入MC,
ifFrameLoaded ("end" ) {
gotoAndPlay("开始播放的地方");
}
"
"将Loading做成一个MC",那么"MC"是什么?怎么做?
脚本又该写在哪里?
答案或建议:
MC是实例名称.影片剪辑和按钮都可以自己在场景中命实例名称.有了实例名称就可以用语句来控制实例名称所对应该的元件了.
其它你如果是初学者的话,我给你一段编好的代码.把代码复制到影片的第一帧就可以了.就做好了加载效果.只有在上传到网上才看得到效果哟
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 = "";
}
}
转载本文请保留:http://www.baikewenda.com/tech/soft/7/5/a102062814.htm