# Show image at certain percentage

**URL:** <https://forum.kirupa.com/t/show-image-at-certain-percentage/305362>\
**Category:** flash\
**Created:** [February 24, 2010, 2:26am UTC](https://forum.kirupa.com/t/show-image-at-certain-percentage/305362 "2010-02-24T02:26:19Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sith717](https://avatars.discourse-cdn.com/v4/letter/s/9fc348/32.png) [@Sith717](https://forum.kirupa.com/u/Sith717)\
**Post date:** [February 24, 2010, 2:26am UTC](https://forum.kirupa.com/t/show-image-at-certain-percentage/305362/1 "2010-02-24T02:26:19Z")

</div>

Is there a way I can do it so at a certain percentage of the preloader a image shows up?

Like lets say from 0-49% the background is black  
then once it hits 50% an image shows up as the background, and stays there until 100%

so basicly 0-49% = black background  
and 50-100% = show an image as a background

Is that possible?

Also, here is my current code I would like to add that option to:

```php
stop();

this.addEventListener(Event.ENTER_FRAME, loading);

function loading(e:Event):void {

    var total:Number = this.stage.loaderInfo.bytesTotal;
    var loaded:Number = this.stage.loaderInfo.bytesLoaded;

    bar_mc.scaleX = loaded/total;
    loader_txt.text = "Loading config - " + Math.floor((loaded/total)*100) + "%";

    if (total == loaded) {
        play();
        this.removeEventListener(Event.ENTER_FRAME, loading);
    }

}

```

Also, this is a preloader.
