Goes in a empty keyframe actions at the beginning of your movie.
[code:1]stop();
MakeBox();
Ready = false;
mouseClicked = true
_root.createTextField("percent", 2, Stage.width/4, (Stage.height/3)+50, 300, 100);
MakeText("Loading....");
function MakeBox() {
_root.createEmptyMovieClip("loadBox", 4);
loadBox.lineStyle(5, 0x000000, 100);
loadBox.moveTo(Stage.width/4, (Stage.height/3)+120);
loadBox.lineTo((Stage.width/4)+300, (Stage.height/3)+120);
loadBox.lineTo((Stage.width/4)+300, (Stage.height/3)+140);
loadBox.lineTo(Stage.width/4, (Stage.height/3)+140);
loadBox.lineTo(Stage.width/4, (Stage.height/3)+120);
}
function MakeLoadBar() {
_root.createEmptyMovieClip("loadBar", 3);
loadBar.lineStyle(20, 0xf99f99, 100);
loadBar.moveTo((Stage.width/4)+8, ((Stage.height/3)+120)+10);
loadBar.lineTo((Stage.width/4)+(percentage*2.9), ((Stage.height/3)+120)+10);
}
function MakeText(textValue) {
_root.createTextField("loading", 1, Stage.width/4, Stage.height/3, 300, 100);
textFormat = new TextFormat();
textFormat.size = "50";
_root.loading.text = textValue;
_root.loading.setTextFormat(textFormat);
}
function onEnterFrame() {
_root.percent.text = percentage+"%";
percentage = (_root.getBytesLoaded()/_root.getBytesTotal())*100;
_root.percent.setTextFormat(textFormat);
if (_root.percent.text == "100%" && Ready == false) {
MakeText("Click To Play");
Ready = true;
} else if (Ready == false) {
MakeLoadBar();
}
}
function onMouseDown() {
if (Ready == true && mouseClicked == true) {
_root.percent.removeTextField();
_root.loading.removeTextField();
loadBar.unloadMovie();
loadBox.unloadMovie();
gotoAndPlay(2);
mouseClicked = false
}
}
[/code:1]