PDA

View Full Version : Preloader Problems



anix
July 21st, 2008, 08:10 AM
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,checkLoadi ngProgress);

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,checkPr ogress);
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,checkLo adingProgress);

this.gotoAndPlay(2);
}

}

flashdeva
July 21st, 2008, 08:24 AM
Check if the control goes to Enterframe event
I guess the control goes to the else part of the enterframe and probably the enterframe event is getting cancelled
How are you adding the Gate Movieclip, manually or dynamically ? If your Gate Movieclip has some other movieclips in them then the flash player will not play them for you

anix
July 21st, 2008, 08:36 AM
Hi im not too sure what you mean by "Check if the control goes to Enterframe event" sorry lol, im not too sure why it would go to the else part of the if statements if it is going there, and i added the movie clip gate to the stage manually thanks

Alex Lexcuk
July 21st, 2008, 11:10 AM
ExportSecondFrame
Look example
http://etcs.ru/flash/export/ExportSecondFrame.zip
This code work in game
http://www.dnadillo.dn.ua/fla/Puzzle-murzle-8-final.html
look document class
ExportSecondFrameExample.as
look file program.as for MovieClip in liblary Program
ctrl+enter - view - Download Setting - 14.4(1.2 kb/s) - ctrl+enter

End
not to forget
Ctrl+Shift+F12 ActionScript version - setting
Export clases for frame 2