Hi i am having problems with a AS3 Preloader that i am trying to design, i really havn’t designed a preloader in AS3 before and im not really sure what im doing lol! i am trying to add a preloader on the 1st fram and i have all my other elements on the second frame and once 100percent is reached i want the program to go to frame 2. Ihave a gate animation on the first frame also that i want to play through as the infromation is loading however when i run my code with everything on the stage i get a black screen untill it has loaded and then it goes to frame 2, i dont get any errors and the code appears to run ok but i cant see any loading txt or my animation, i would really appreciate it if anyone can help me with this thanks!
stop();
this.addEventListener(Event.ENTER_FRAME,checkLoadingProgress);
function checkLoadingProgress(_prog:Event):void
{
var bytes_loaded:Number = _prog.target.loaderInfo.bytesLoaded;
var bytes_total:Number = _prog.target.loaderInfo.bytesTotal;
var percent:Number = Math.round(bytes_loaded/bytes_total*100);
info_txt.text = percent.toString()+' %';
if (percent == 10)
{
//this.removeEventListener(Event.ENTER_FRAME,checkProgress);
gate.gotoAndPlay(1);
//lets_go();
}
else if (percent == 20)
{
gate.gotoAndPlay(15);
}
else if (percent == 30)
{
gate.gotoAndPlay(30);
}
else if (percent == 40)
{
gate.gotoAndPlay(45);
}
else if (percent == 50)
{
gate.gotoAndPlay(60);
}
else if (percent == 60)
{
gate.gotoAndPlay(75);
}
else if (percent == 70)
{
gate.gotoAndPlay(90);
}
else if (percent == 80)
{
gate.gotoAndPlay(105);
}
else if (percent == 90 & percent < 100)
{
gate.gotoAndPlay(120);
}
else
{
this.removeEventListener(Event.ENTER_FRAME,checkLoadingProgress);
this.gotoAndPlay(2);
}
}