# Preloader behaving weird

**URL:** <https://forum.kirupa.com/t/preloader-behaving-weird/183428>\
**Category:** Uncategorized\
**Created:** [March 27, 2006, 12:10am UTC](https://forum.kirupa.com/t/preloader-behaving-weird/183428 "2006-03-27T00:10:28Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![rawnewdlz](https://avatars.discourse-cdn.com/v4/letter/r/e19adc/32.png) [@rawnewdlz](https://forum.kirupa.com/u/rawnewdlz)\
**Post date:** [March 27, 2006, 12:10am UTC](https://forum.kirupa.com/t/preloader-behaving-weird/183428/1 "2006-03-27T00:10:28Z")

</div>

Hi,  
my preloader is working when its first run, but it doesn’t go to the 2nd frame if the page is refreshed. (Its for a swf that has about 9,000 frames but I don’t think thats the issue)

```auto

onClipEvent (enterFrame) {
    mctotal = _root.getBytesTotal();
    mcloaded = _root.getBytesLoaded();
    mcpercent = Math.round((mcloaded/mctotal)*100);
    kb_load = Math.round(mcloaded/1000);
    kb_total = Math.round(mctotal/1000);
    loadBar._xscale = mcpercent;
    loadKb = kb_load + "kb load /" + kb_total + "kb total";
    loadText = mcpercent + "%";
    if (mcpercent == 99) {
        _root.gotoAndPlay(2);        
    }
}

```

Any suggestions would be greatly appreciated

---

<div class="post-metadata">

**Author:** ![stereochris](https://avatars.discourse-cdn.com/v4/letter/s/f4b2a3/32.png) [@stereochris](https://forum.kirupa.com/u/stereochris)\
**Post date:** [March 27, 2006, 12:21am UTC](https://forum.kirupa.com/t/preloader-behaving-weird/183428/2 "2006-03-27T00:21:12Z")

</div>

it’s right here --\>\> [COLOR=#0000ff]if[/COLOR] [COLOR=#000000]([/COLOR]mcpercent == [COLOR=#000080]99[/COLOR][COLOR=#000000])[/COLOR]  
[COLOR=#000000][/COLOR]  
[COLOR=#000000]You’re checking if the loaded percent of the SWF is ONLY equal to 99, but if you refresh the page, and the SWF has already been loaded and cache’d then the loaded percent is going to be 100, so whatever actions you have after the if (something) {… won’t work[/COLOR]  
[COLOR=#000000][/COLOR]  
[COLOR=#000000]Change it to…[/COLOR]  
[COLOR=#000000][/COLOR]  
[COLOR=#000000]**[COLOR=#0000ff]if[/COLOR] [COLOR=#000000]([/COLOR]mcpercent \>= [COLOR=#000080]99[/COLOR][COLOR=#000000]) {[/COLOR]**[/COLOR]  
[COLOR=#000000][COLOR=#000000][/COLOR][/COLOR]  
[COLOR=#000000][COLOR=#000000]That should do it…[/COLOR][/COLOR]

---

<div class="post-metadata">

**Author:** ![rawnewdlz](https://avatars.discourse-cdn.com/v4/letter/r/e19adc/32.png) [@rawnewdlz](https://forum.kirupa.com/u/rawnewdlz)\
**Post date:** [March 27, 2006, 1:40am UTC](https://forum.kirupa.com/t/preloader-behaving-weird/183428/3 "2006-03-27T01:40:44Z")

</div>

thanks it worx.

what would I do if it were in a seperate swf loaded into an mcHolder?

---

<div class="post-metadata">

**Author:** ![stereochris](https://avatars.discourse-cdn.com/v4/letter/s/f4b2a3/32.png) [@stereochris](https://forum.kirupa.com/u/stereochris)\
**Post date:** [March 27, 2006, 2:37am UTC](https://forum.kirupa.com/t/preloader-behaving-weird/183428/4 "2006-03-27T02:37:44Z")

</div>

If what i was in a seperate SWF? The loader? I’m pretty sure if the loader was in a different clip, you could just use the same code.

---

<div class="post-metadata">

**Author:** ![rawnewdlz](https://avatars.discourse-cdn.com/v4/letter/r/e19adc/32.png) [@rawnewdlz](https://forum.kirupa.com/u/rawnewdlz)\
**Post date:** [March 27, 2006, 2:48am UTC](https://forum.kirupa.com/t/preloader-behaving-weird/183428/5 "2006-03-27T02:48:27Z")

</div>

it was working just fine but now I have to have it (the swf w/an mc preloader) Load into a main swf’s mc. I don’t know why it wouldn’t work, unless its bcuz the AS is on an mc rather than a frame?
