# Creating loading % bar

**URL:** <https://forum.kirupa.com/t/creating-loading-bar/5362>\
**Category:** flash\
**Created:** [September 9, 2002, 1:47am UTC](https://forum.kirupa.com/t/creating-loading-bar/5362 "2002-09-09T01:47:05Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![LostSoul](https://avatars.discourse-cdn.com/v4/letter/l/d6d6ee/32.png) [@LostSoul](https://forum.kirupa.com/u/LostSoul)\
**Post date:** [September 9, 2002, 1:47am UTC](https://forum.kirupa.com/t/creating-loading-bar/5362/1 "2002-09-09T01:47:05Z")

</div>

Does anyone know how to create a percentage bar for use in showing the amount left to load?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 9, 2002, 4:39am UTC](https://forum.kirupa.com/t/creating-loading-bar/5362/2 "2002-09-09T04:39:42Z")

</div>

Make a movie clip and design a rectangle the size you want your preloader bar to be, make sure you make it **aligned right** in your clip by using the align panel and give it an instance name of ‘ **loader\_bar** ’ and place it on your \_root timeline

Select frame 1 and place this code into your actions window:

```auto
kbytes_total = getBytesTotal() / 1024;
kbytes_loaded = getBytesLoaded() / 1024;
percent = Math.round((kbytes_loaded/kbytes_total)*100);
loader_bar._xscale = percent;
if(kbytes_loaded >= kbytes_total) {
	_root.gotoAndPlay(3);
}

```

Select frame 2 and press **F6** to make a new keyframe and place this code in the actions window:

```auto
gotoAndPlay(1);

```

Now your main flash movie will start on frame 3 and its as simple as that a 2 frame preloader!

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 9, 2002, 10:59pm UTC](https://forum.kirupa.com/t/creating-loading-bar/5362/3 "2002-09-09T22:59:19Z")

</div>

Dan…you might have to come on AIM and find me…this isnt working. It does nothing when I paste wut u wrote…
