# onLoadProgress with xml gallery

**URL:** <https://forum.kirupa.com/t/onloadprogress-with-xml-gallery/252862>\
**Category:** flash\
**Created:** [February 24, 2008, 6:21pm UTC](https://forum.kirupa.com/t/onloadprogress-with-xml-gallery/252862 "2008-02-24T18:21:04Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ripagiga06](https://avatars.discourse-cdn.com/v4/letter/r/838e76/32.png) [@ripagiga06](https://forum.kirupa.com/u/ripagiga06)\
**Post date:** [February 24, 2008, 6:21pm UTC](https://forum.kirupa.com/t/onloadprogress-with-xml-gallery/252862/1 "2008-02-24T18:21:04Z")

</div>

i’m using the xml gallery  
so target\_mc is equal to thumbnail\_mc.t0, thumbnail\_mc.t1, etc.

what i need is the highest bytesTotal of the target\_mc when the onLoadProgress goes through each target\_mc(thumbnail\_mc.t0, thumbnail\_mc.t1, etc.) to be a variable

so the percent var would look something like this  
ActionScript Code:  
[FONT=Courier New][LEFT][COLOR=#000000] **var** [/COLOR] percent:[COLOR=#0000FF]Number[/COLOR] = [COLOR=#0000FF]Math[/COLOR].[COLOR=#0000FF]floor[/COLOR]COLOR=#000000[/COLOR]  
[/LEFT]  
[/FONT]

and if statement would look like this  
ActionScript Code:  
[FONT=Courier New][LEFT][COLOR=#0000FF]if[/COLOR][COLOR=#000000]([/COLOR][COLOR=#0000FF]bytesLoaded[/COLOR] != highestBytesTotal[COLOR=#000000])[/COLOR]  
[/LEFT]  
[/FONT]

this is what i have now for onLoadProgress  
ActionScript Code:  
[FONT=Courier New][LEFT][COLOR=#808080]_//onLoadProgress(mc in which content is being loaded, # of loaded bytes, # of total bytes) method [/COLOR]  
[COLOR=#808080]//which sets the properties and find the getBytesLoaded() and getTotalBytes() of thumbs_[/COLOR]  
tlistener.[COLOR=#0000FF]onLoadProgress[/COLOR] = [COLOR=#000000] **function** [/COLOR][COLOR=#000000]([/COLOR]target\_mc, [COLOR=#0000FF]bytesLoaded[/COLOR], [COLOR=#0000FF]bytesTotal[/COLOR][COLOR=#000000])[/COLOR][COLOR=#000000]{[/COLOR]  
[COLOR=#808080]_//create the percentage variable_[/COLOR]  
[COLOR=#000000] **var** [/COLOR] percent:[COLOR=#0000FF]Number[/COLOR] = [COLOR=#0000FF]Math[/COLOR].[COLOR=#0000FF]floor[/COLOR]COLOR=#000000[/COLOR];  
[COLOR=#808080]_//check to see if bytesLoaded is not equal to the bytesTotal_[/COLOR]  
[COLOR=#0000FF]if[/COLOR][COLOR=#000000]([/COLOR][COLOR=#0000FF]bytesLoaded[/COLOR] != [COLOR=#0000FF]bytesTotal[/COLOR][COLOR=#000000])[/COLOR][COLOR=#000000]{[/COLOR]  
preLoader\_mc.[COLOR=#000080]loader\_txt[/COLOR].[COLOR=#0000FF]selectable[/COLOR] = [COLOR=#000000] **false** [/COLOR];  
preLoader\_mc.[COLOR=#000080]loader\_txt[/COLOR].[COLOR=#0000FF]text[/COLOR]= percent+[COLOR=#FF0000]"%"[/COLOR];  
[COLOR=#000000]}[/COLOR][COLOR=#0000FF]else[/COLOR][COLOR=#000000]{[/COLOR]  
[COLOR=#808080]_//remove this preloader_[/COLOR]  
preLoader\_mc.[COLOR=#0000FF]removeMovieClip[/COLOR]COLOR=#000000[/COLOR];  
[COLOR=#000000]}[/COLOR]  
[COLOR=#000000]}[/COLOR]  
[/LEFT]  
[/FONT]
