# Load Progress Problems

**URL:** <https://forum.kirupa.com/t/load-progress-problems/268050>\
**Category:** flash\
**Created:** [August 8, 2008, 4:39pm UTC](https://forum.kirupa.com/t/load-progress-problems/268050 "2008-08-08T16:39:36Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![blackpool](https://avatars.discourse-cdn.com/v4/letter/b/46a35a/32.png) [@blackpool](https://forum.kirupa.com/u/blackpool)\
**Post date:** [August 8, 2008, 4:39pm UTC](https://forum.kirupa.com/t/load-progress-problems/268050/1 "2008-08-08T16:39:36Z")

</div>

Hi, I’m trying to implement a progress bar. Currently, I load in the picture - there is a listener to tell when it is loaded, and then it fades in. I’m trying to add a progress bar to this, and not getting much success. Could someone point me in the correct direction? Thanks!

```auto

import fl.transitions.Tween;
import fl.transitions.easing.*;
import flash.events.ProgressEvent;

var fadeIn:Tween;
var mainPicArea:MovieClip = new MovieClip();

var mainPicPlacementX:Number = 309.6;
var mainPicPlacementY:Number = 37.6;
var mainLoader:Loader = new Loader();
var mainRequest:URLRequest = new URLRequest();

function loadPic(picName):void
{
if (mainPicArea.numChildren)
{
	trace("test " + mainPicArea.numChildren);
	mainPicArea.removeChild(mainLoader);	
}

addChild(mainPicArea);
mainLoader = new Loader();
mainRequest = new URLRequest ( picName );
mainLoader.load( mainRequest );
loadText_mc.visible = true;
mainLoader.addEventListener(ProgressEvent.PROGRESS, loadProgress);
mainLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, mainLoaded);
}

function loadProgress(event:ProgressEvent):void
{
	var percent:Number = Math.floor( (event.bytesLoaded*100)/event.bytesTotal );
	if(preloaderMC is MovieClip){
		preloaderMC.gotoAndStop(percent);
	}
	if(percent == 100){
		trace("DONE LOADING PIC");
	}
}

function mainLoaded(event:Event):void
{
	loadText_mc.visible = false;
	mainPicArea.x = mainPicPlacementX;
	mainPicArea.y = mainPicPlacementY;
	fadeIn = new Tween(mainPicArea, "alpha", None.easeOut, 0, 1,12, false);
	mainPicArea.addChild(mainLoader);	
	trace(mainPicArea.numChildren + "hello");
}

```
