Preloader that loads MC in segments

Hi, I have a MC named “preloader”. Inside this MC got 10 frames and each of it represents a pencil. Frame 1 had 1 pencil, frame 2 had 2 pencils… and so on until frame 10(10 pencils ofcoz)

After that I adding 3 frames on my root. Frame 1 is Actionscript as follow:

totalBytes = Math.round(getBytesTotal()/1024);
loadedBytes = Math.round(getBytesLoaded()/1024);
percentDone = Math.round((loadedBytes/totalBytes)*100);
if (percentDone==20)
{
 _root.preloader.gotoAndStop(2);
}
if (percentDone==30)
{
 _root.preloader.gotoAndStop(3);
}
if (percentDone==40)
{
 _root.preloader.gotoAndStop(4);
}
if (percentDone==50)
{
 _root.preloader.gotoAndStop(5);
}
if (percentDone==60)
{
 _root.preloader.gotoAndStop(6);
}
if (percentDone==70)
{
 _root.preloader.gotoAndStop(7);
}
if (percentDone==80)
{
 _root.preloader.gotoAndStop(8);
}
if (percentDone==90)
{
 _root.preloader.gotoAndStop(9);
}
if (_root._framesloaded>=_root._totalframes) {
 gotoAndPlay("start");
}

Frame 2 also AS(to perform the loop) as follow:

gotoAndPlay(1)

Frame 3 got the pen MC and I named this frame “start”.

This flash running without any errors.

My question is, is there a more pro way to make this code become shorter by using any loop/array? Coz I just good in if…else statement. Maybe u guys can help me out :slight_smile: Im still in learning process…

Thanks a lot.

Eric