# Preload for pictures loaded from XML

**URL:** <https://forum.kirupa.com/t/preload-for-pictures-loaded-from-xml/257051>\
**Category:** Uncategorized\
**Created:** [April 9, 2008, 7:48pm UTC](https://forum.kirupa.com/t/preload-for-pictures-loaded-from-xml/257051 "2008-04-09T19:48:12Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![sivant](https://avatars.discourse-cdn.com/v4/letter/s/cc9497/32.png) [@sivant](https://forum.kirupa.com/u/sivant)\
**Post date:** [April 9, 2008, 7:48pm UTC](https://forum.kirupa.com/t/preload-for-pictures-loaded-from-xml/257051/1 "2008-04-09T19:48:12Z")

</div>

i have a preloader that at the second frame i am getting the total bytes of all the pictures. which are located in a MC. i looped it so i would have the total bytes of all pictures in one variable.

```auto

for (var m:Number = 0; m<_parent.total; m++) {
 totalBytes = totalBytes+_root.contentMain["targetClip"+m].getBytesTotal();
}

```

i cant figure out how to do the rest. i added on the third frame this:

```auto

totalBytesLoaded = _root.contentMain["targetClip"+i].getBytesLoaded();
thePer = int((100*totalBytesLoaded)/totalBytes);

```

thePer represents the precantage of the loaded bytes  
and on the last frame:

```auto

if (thePer > 99) {
 _parent.play();
} else {
 gotoAndPlay(3);
 i++;
}

```

and thePer goes up to 15 and back to 0.  
i tried all kind of things that is the last unsucsess  
can anybody help me with this?
