# Simple question?

**URL:** <https://forum.kirupa.com/t/simple-question/277536>\
**Category:** Uncategorized\
**Created:** [December 13, 2008, 6:49am UTC](https://forum.kirupa.com/t/simple-question/277536 "2008-12-13T06:49:46Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![stulock\_net](https://avatars.discourse-cdn.com/v4/letter/s/eb9ed0/32.png) [@stulock\_net](https://forum.kirupa.com/u/stulock_net)\
**Post date:** [December 13, 2008, 6:49am UTC](https://forum.kirupa.com/t/simple-question/277536/1 "2008-12-13T06:49:46Z")

</div>

My first post here. I am building a preloader and have a design wherein there are 5 lights in a row. Each light consists of 3 circles on top of each other in the following manner:

top layer: red light  
middle layer: green light  
bottom layer: circle outline

When my Number variable for loaderInfo reaches .2 (or 20% loaded), i want the red circle to dissapear and expose the green light. This pattern will continue for each of the 5 lights

- red light 1 dissapears at 20% loaded
- red light 2 dissapears at 40% loaded
- red light 3 dissapears at 60% loaded
- red light 4 dissapears at 80% loaded
- red light 5 dissapears at 100% loaded

I am guessing this is a for loop, but I do not know how to structure it. Here is my code

stop();

//event Listener for the root timeline’s loaderInfo property  
//whenever anything loads on the main timeline, progressHandler is called  
root.loaderInfo.addEventListener(ProgressEvent.PROGRESS, progressHandler);

//function progressHandler with a ProgressEvent event as its parameter  
function progressHandler(myevent:ProgressEvent):void{  
//show progress  
var myprogress:Number=myevent.target.bytesLoaded/myevent.target.bytesTotal;  
//number progress using textbox called countingText  
countingText.text = Math.round(myprogress\*100)+"%";  
//trace(myprogress);  
if (myprogress == .2){  
removeChild(redCircle1);  
}  
}  
[COLOR=Red]

I am trying to use an if statement to signal the appropriate time for redCircle1’s removal, but apparently it doesn’t work. It only works when myprogress == 1 because it finishes totally.

The screenshot is what it should look like at 20%

Thanks for any help!  
[/COLOR]
