Add the following code to-root the first frame is OK.
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); Progress bar
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); Progress display text
Loadinfo.createtextfield ("TXT", 0, 0, _linelen, 22);
LoadInfo.txt.autoSize = _txtalign; Set the position of the progress bar (centered at the home view)
loadinfo._x = (Stage.width-_linelen)/2;
loadinfo._y = STAGE.HEIGHT/2; Get the movie size and stop, then 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 = "";
}
}
Mailto:hjs0724@163.com