# Problem with preloader

**URL:** <https://forum.kirupa.com/t/problem-with-preloader/221342>\
**Category:** Uncategorized\
**Created:** [April 3, 2007, 2:37pm UTC](https://forum.kirupa.com/t/problem-with-preloader/221342 "2007-04-03T14:37:15Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![RubenFlash](https://avatars.discourse-cdn.com/v4/letter/r/839c29/32.png) [@RubenFlash](https://forum.kirupa.com/u/RubenFlash)\
**Post date:** [April 3, 2007, 2:37pm UTC](https://forum.kirupa.com/t/problem-with-preloader/221342/1 "2007-04-03T14:37:15Z")

</div>

Hello, fellow flash addicts! 🍺

Please, have a look at this code:

```php

total = 0;
carregado = 0;
perc = 0;
loading._visible = false;
loading.onEnterFrame = function(){
    this._visible = true;
    carregado = img.getBytesLoaded();
    total = img.getBytesTotal();
    perc = Math.round(carregado / total * 100);
    this.loading._xscale = perc;
    if (carregado == total){
        this._visible = false;
        delete this.onEnterFrame;
    }
}

```

Seems like everything`s right, dont you agree? The problem is that, when I do “Simulate download” in Flash, the movieclip loading simply disappears! I did a few traces, and it seems that, when the movies loads, for a brief milisecond, the condition “carregado == total” is true, and that really screws the all thing. So, any of you guys could help me?

Thanks a lot!
