# Preloader that loads MC in segments

**URL:** https://forum.kirupa.com/t/preloader-that-loads-mc-in-segments/166152
**Category:** Uncategorized
**Created:** [October 17, 2005, 5:44pm UTC](https://forum.kirupa.com/t/preloader-that-loads-mc-in-segments/166152 "2005-10-17T17:44:44Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![eric\_chua](https://avatars.discourse-cdn.com/v4/letter/e/f9ae1b/32.png) [@eric\_chua](https://forum.kirupa.com/u/eric_chua)
#### Post date: [October 17, 2005, 5:44pm UTC](https://forum.kirupa.com/t/preloader-that-loads-mc-in-segments/166152/1 "2005-10-17T17:44:44Z")

</div>

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:

```auto
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:

```auto
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 🙂 Im still in learning process…

Thanks a lot.

Eric
