# Problem with ProgressEvent

**URL:** <https://forum.kirupa.com/t/problem-with-progressevent/230857>\
**Category:** flash\
**Created:** [June 29, 2007, 1:35pm UTC](https://forum.kirupa.com/t/problem-with-progressevent/230857 "2007-06-29T13:35:21Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Natan](https://avatars.discourse-cdn.com/v4/letter/n/b38774/32.png) [@Natan](https://forum.kirupa.com/u/Natan)\
**Post date:** [June 29, 2007, 1:35pm UTC](https://forum.kirupa.com/t/problem-with-progressevent/230857/1 "2007-06-29T13:35:21Z")

</div>

Hello.

I am migrating my aplications from ActionScript 2 to ActionScript3 and i have a problem with the LoadProgress. I create a gallery using XML, this gallery show a small image and when i click in this small image the larger image show.

The small images are loaded in a MovieClip that is imported from the Library. So, for each small image i import a MovieClip on the stage. The problem is show the load progress from this small images.

In ActionScrip i use something like this:

[AS]var loader:MovieClipLoader = new MovieClipLoader();  
var listener:Object = new Object();  
for (var i=0; i\<5; i++) {  
var mc:MovieClip = holder.attachMovie(“id”, “id”+i, \_root.getNextHighestDepth());  
mc.\_x = i_mc.\_width+i_10;  
loader.loadClip(“image”+i, holder.mcTarget);  
}  
listener.onLoadProgress = function (targetMc:MovieClip, btLoaded:Number, btTotal:Number) {  
var progress:Number = Math.round(btLoaded/btTotal\*100);  
targetMc.\_parent.preloader.\_xscale = progress;  
}  
loader.addListener(listener);[/AS]

The holder is a MovieClip that i use to import the MovieClips from the library, the preloader is the MovieClip to show the load progress. With this i can show the load progress from the small image.

But, with the ActionScript 3 i cant do this, i try to use some like this:

[AS]var loader:Loader = new Loader();  
for (var i=0; i\<5; i++) {  
var mc:MovieClip = new item();  
holder.addChild(mc);  
mc.x = i_mc.width+i_10;  
loader.load(new URLRequest(“image”+i));  
mc.mcTarget.addChild();  
loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, loadProgress);  
}  
function loadProgress(event:ProgressEvent):void {  
var progress:Number = Math.round((event.bytesLoaded/event.bytesTotal)\*100);  
event.target.parent.preloader.scaleX = progress;  
}[/AS]

But, the Flash return a error and in can discover how fix this problem, how the load progress from that small images.

Some somebody knows how to do this? I think that i need create some Class for this MovieClip that is imported from a library.

Thanks
