# Help me to re-write this code!

**URL:** <https://forum.kirupa.com/t/help-me-to-re-write-this-code/225475>\
**Category:** flash\
**Created:** [May 12, 2007, 7:29am UTC](https://forum.kirupa.com/t/help-me-to-re-write-this-code/225475 "2007-05-12T07:29:08Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![darkstyle](https://avatars.discourse-cdn.com/v4/letter/d/a5b964/32.png) [@darkstyle](https://forum.kirupa.com/u/darkstyle)\
**Post date:** [May 12, 2007, 7:29am UTC](https://forum.kirupa.com/t/help-me-to-re-write-this-code/225475/1 "2007-05-12T07:29:08Z")

</div>

This code works when i publish in flash player 6 version  
Could some one help to re-write this code in flash player 8 version??

```php
this.onEnterFrame = function() {
    //this checks to see if the content on this timeline is still loading
    if (this.getBytesLoaded()<this.getBytesTotal()) {
        //make the preloader visible
        _level0.preloaderGraphics._visible=true;
        //make a variable to store the total file size of this timeline
        Total = this.getBytesTotal()/1000;
        //make a variable to store the amount of this timeline that has loaded
        Received = this.getBytesLoaded()/1000;
        //make a variable to store the percentage loaded
        Percentage = (Received/Total)*100;
        //target the text box in the preloaderGraphics mc and tell it what to display
        _level0.preloaderGraphics.percent = int(Percentage) add "%";
        //change the x scale of the progess bar to indicate how much has loaded
        _level0.preloaderGraphics.progressBar._xscale = Percentage;
    } else {
        //play the intro animation
        this.gotoAndPlay("intro");
        //turn off the enterFrame action
        this.onEnterFrame = null;
        //hide the preloader
        _level0.preloaderGraphics._visible=false;
    }
};
//stop this timeline while it loads
stop();

```
