Okay I have a preloader I’ve used many times in other flash applications. What my proplems is, I’ve got two scenes. First scene has the preloader code provided below. You simply stick the code in a blank keyframe in Scene 1, then in Scene 2 is where I have my full flash site. It contains one frame with about 12 layers of movie clips in each first frame. There’s a few empty container mc’s that load from buttons and just simple animation mc’s. For some reason the preloader is freaking out and when I go to test the movie it’s rapidly flashing from Scene 1 to Scene 2 over and over and over. It’s extremely frustrating why I can’t get this one to work when I’ve used this same code in a few other flash projects that worked just fine. Anybody have a clue what I may need to fix to get it to work. Here’s the code.
First off real quick, here’s my setup.
Scene 1 (preloader)
–layer 1, frame 1 “preloader code”
Scene 2 (flash site)
–layer 1, frame 1 “nav menu mc”
–layer 2, frame 1 “empty container mc for external swf’s”
–layer 3, frame 1 “tweened animation mc”
–layer…(and you get the idea)
Is it because I have too many movie clips in frame one down the layer line? That shouldn’t matter right?
// do not alterate this script
// This script was build by Cosmin Varlan ([email="vcosmin@uaic.ro"]vcosmin@uaic.ro[/email])
lungime_preloader = 185;
inaltime_preloader = 40;
preloader_x = 310;
preloader_y = 233;
var text_format = new TextFormat();
text_format.font = "Arial";
text_format.size = 11;
text_format.color = 0x444444;
text_format.bold = true;
text_format.align = "center";
_root.createEmptyMovieClip("bg", 1);
with (_root.bg) {
_x = preloader_x;
_y = preloader_y;
lineStyle(0.1, 0xffffff, 60);
beginFill(0xffffff, 40);
moveTo(5, 0);
lineTo(lungime_preloader-5, 0);
lineTo(lungime_preloader-5, 40);
lineTo(5, 40);
lineTo(5, 0);
endFill();
}
_root.createEmptyMovieClip("loader", 2);
with (_root.loader) {
_x = Math.ceil(_root.bg._width/2)-46+_root.bg._x;
_y = _root.bg._y+10;
lineStyle(0.1, 0x333333, 100);
moveTo(0, 0);
lineTo(102, 0);
lineTo(102, 10);
lineTo(0, 10);
lineTo(0, 0);
}
_root.createEmptyMovieClip("bar", 3);
with (_root.bar) {
_x = _root.loader._x+1.5;
_y = _root.loader._y+1.5;
lineStyle(0.1, 0x00ffff, 60);
}
_root.createTextField("proc", 4, _root.loader._x, _root.loader._y+10, 102, 20);
_root.createEmptyMovieClip("motor", -1);
_root.motor.onEnterFrame = function() {
_root.total = _root.getBytesTotal();
_root.incarcat = _root.getBytesLoaded();
_root.procent = Math.floor(_root.incarcat*100/_root.total);
if (procent<100) {
with (_root.bar) {
clear();
beginFill(0x0006FF, 40);
moveTo(0, 0);
lineTo(_root.procent, 0);
lineTo(_root.procent, 8);
lineTo(0, 8);
lineTo(0, 0);
endFill();
_root.proc.text = _root.procent;
_root.proc.setTextFormat(text_format);
}
} else {
_root.bg.removeMovieClip();
_root.loader.removeMovieClip();
_root.bar.removeMovieClip();
_root.proc.removeTextField();
nextScene();
play();
}
};
stop();