把下面的代码加到-root第一桢就OK了。varmyLoading:MovieClip;
varloadInfo:MovieClip;
var_lineBgcolor="0x666666";
var_lineColor="0x0000FF";
var_lineLen:Number=200;
var_lineH:Number=3;
var_txtColor;
var_txtAlign:String="center";
vartb:Number;
vartxtFormat:TextFormat=newTextFormat("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(){
varlb:Number=_root.getBytesLoaded();
varpercent: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();
deletethis.onEnterFrame;
loadInfo.clear();
loadInfo.txt.text="";
}
}
//mailto:hjs0724@163.com