# Transition preloader question

**URL:** <https://forum.kirupa.com/t/transition-preloader-question/55314>\
**Category:** Uncategorized\
**Created:** [June 22, 2004, 9:54pm UTC](https://forum.kirupa.com/t/transition-preloader-question/55314 "2004-06-22T21:54:25Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![scottybuckets](https://avatars.discourse-cdn.com/v4/letter/s/9de053/32.png) [@scottybuckets](https://forum.kirupa.com/u/scottybuckets)\
**Post date:** [June 22, 2004, 9:54pm UTC](https://forum.kirupa.com/t/transition-preloader-question/55314/1 "2004-06-22T21:54:25Z")

</div>

Probably been asked before but I searched and searched and could not find the answer to my preloader question/problem…

I’m just trying to add a percentage read out along with the loading bar (in the transition)… can someone lead me to a thread or post a script for this? tanx 😉

the as im using right now is the script from the tutorial.

loading.\_xscale = 0;  
loading.onEnterFrame = function() {  
this.\_xscale = 100\*\_parent.content.getBytesLoaded()/\_parent.content.getBytesTotal();  
};  
loadMovie(\_root.section, \_root.content);  
stop();

---

<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:** [July 9, 2004, 6:00pm UTC](https://forum.kirupa.com/t/transition-preloader-question/55314/2 "2004-07-09T18:00:02Z")

</div>

back to the top 🙂

i have the preloader working but its just a percentage bar and loading text… now i want to add a percentage readout (1%-100%)

can anyone help me out with this? thanks in advance

---

<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:** [July 9, 2004, 6:03pm UTC](https://forum.kirupa.com/t/transition-preloader-question/55314/3 "2004-07-09T18:03:22Z")

</div>

myTxtBox = (totalBytes/loadedBytes\*100)+’%’;

something like that…

🙂

---

<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:** [July 9, 2004, 6:09pm UTC](https://forum.kirupa.com/t/transition-preloader-question/55314/4 "2004-07-09T18:09:02Z")

</div>

i will try that thanks… be back soon

---

<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:** [July 9, 2004, 6:29pm UTC](https://forum.kirupa.com/t/transition-preloader-question/55314/5 "2004-07-09T18:29:23Z")

</div>

ok… i added the script but now my loading bar does not show and the percentage readout stays at NaN%

any other suggestions?

---

<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:** [July 9, 2004, 6:34pm UTC](https://forum.kirupa.com/t/transition-preloader-question/55314/6 "2004-07-09T18:34:04Z")

</div>

what is the (complete) code your using? _finds old script_ here’s what i used:

total = Math.round(\_root.getBytesTotal());  
loaded = Math.round(\_root.getBytesLoaded());  
percent = loaded/total;  
this.loaderBar.\_width = percent_100;  
loadText.\_x = percent_100+73;  
loadText.text = Math.round(percent\*100)+"%";  
if (loaded == total) {  
gotoAndPlay(5);  
}

this is actually the code from the loader tutorial here (kirupa) but i modded it so that the text box followed the tip of the loader bar. example [here](http://www.cast.uark.edu/local/cadis/gui27-b.htm).

---

<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:** [July 9, 2004, 6:37pm UTC](https://forum.kirupa.com/t/transition-preloader-question/55314/7 "2004-07-09T18:37:49Z")

</div>

ok… i can get it to work when the site loads… but i’m trying to get it to work during the transition… i used the code from the transition tutorial.

loading.\_xscale = 0;  
loading.onEnterFrame = function() {  
this.\_xscale = 100\*\_parent.content.getBytesLoaded()/\_parent.content.getBytesTotal();  
};  
loadMovie(\_root.section, \_root.content);  
stop();

---

<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:** [July 9, 2004, 6:45pm UTC](https://forum.kirupa.com/t/transition-preloader-question/55314/8 "2004-07-09T18:45:18Z")

</div>

[http://www.kirupa.com/developer/mx/percentagepreloader.htm](http://www.kirupa.com/developer/mx/percentagepreloader.htm)

---

<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:** [July 9, 2004, 6:46pm UTC](https://forum.kirupa.com/t/transition-preloader-question/55314/9 "2004-07-09T18:46:29Z")

</div>

…right. that tute should explain everything to you…

🙂

---

<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:** [July 9, 2004, 6:53pm UTC](https://forum.kirupa.com/t/transition-preloader-question/55314/10 "2004-07-09T18:53:09Z")

</div>

ok im an idiot 🙂 i must have skipped right over that one… thanks fellas

---

<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:** [July 9, 2004, 7:12pm UTC](https://forum.kirupa.com/t/transition-preloader-question/55314/11 "2004-07-09T19:12:45Z")

</div>

No problem, its nice to be able to help people sometimes, rather than always asking for help 😉

---

<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:** [July 9, 2004, 9:05pm UTC](https://forum.kirupa.com/t/transition-preloader-question/55314/12 "2004-07-09T21:05:55Z")

</div>

Regarding the above discussion on preloaders, if I’ve already created a flash movie with button, etc, and want to ADD a preloader, what would I do. I know how to createa preloader, but how would I then link it to an already created file and what would i need to change in the action script?

Hal

---

<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:** [July 9, 2004, 9:07pm UTC](https://forum.kirupa.com/t/transition-preloader-question/55314/13 "2004-07-09T21:07:20Z")

</div>

no clue what your asking m8. when you make a preloader you put it in a different scene and goto the main scene…

🙂

---

<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:** [July 9, 2004, 9:29pm UTC](https://forum.kirupa.com/t/transition-preloader-question/55314/14 "2004-07-09T21:29:50Z")

</div>

Is it not possible for you to just add two frames to the beginning of your file, and move all the current frames to starting on frame 3? Alternatively, you could create an empty mc into the preloader scene which you then use to externally load the swf file. Then I guess you could use \_root. in your loaded swf to tell your preloader how far it has loaded? - I’m hoping someone who knows what they are talking about can help 😉

---

<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:** [July 9, 2004, 9:35pm UTC](https://forum.kirupa.com/t/transition-preloader-question/55314/15 "2004-07-09T21:35:45Z")

</div>

Tried adding the two frames, but now I’m getting this strobing effect between the preloader and the actually movie. Not sure why.

I’ll try it again. Do I have to change anything in actionscript? Do I need to place the name of the movie in there, or will it simply go to frame 3? This is the code I’m using at he moment:

bytes\_loaded = Math.round(this.getBytesLoaded());  
bytes\_total = Math.round(this.getBytesTotal());  
getPercent = bytes\_loaded/bytes\_total;  
this.loadBar.\_width = getPercent_100;  
this.loadText = Math.round(getPercent_100)+"%";  
if (bytes\_loaded == bytes\_total) {  
this.gotoAndPlay(3);  
}

---

<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:** [July 9, 2004, 9:48pm UTC](https://forum.kirupa.com/t/transition-preloader-question/55314/16 "2004-07-09T21:48:34Z")

</div>

Right, maybe if you post your .fla we I can get rid of the strobing problem.

---

<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:** [July 9, 2004, 10:10pm UTC](https://forum.kirupa.com/t/transition-preloader-question/55314/17 "2004-07-09T22:10:27Z")

</div>

> Tried adding the two frames, but now I’m getting this strobing effect between the preloader and the actually movie. Not sure why.  
> that’s because you added a blank keyframe, thus your preloader goes back and forth, on, off, on, off, on, off, on, off, on, off, on, off, on, off, on, off, on, off, on, off, on, off, on, off, on, off, on, off, on, off, on, off, on, off, on, off, on, off, on, off, on, off, on, off, on, off, on, off, on, off, on, off, on, off, on, off, on, off, on, off. (wow. that was one wicked copy paste).

Therefore, add another layer to put your actions; the preloader layer should be visible for the whole 2 frames. (first frame being keyframe, second one being a normal frame)

---

<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:** [July 9, 2004, 11:21pm UTC](https://forum.kirupa.com/t/transition-preloader-question/55314/18 "2004-07-09T23:21:02Z")

</div>

Figured it out. Got it. Thanks, guys!
