# How? Loading from XML and creating sprites based on XML length?

**URL:** <https://forum.kirupa.com/t/how-loading-from-xml-and-creating-sprites-based-on-xml-length/283642>\
**Category:** flash\
**Created:** [March 9, 2009, 3:25pm UTC](https://forum.kirupa.com/t/how-loading-from-xml-and-creating-sprites-based-on-xml-length/283642 "2009-03-09T15:25:43Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![josepilove](https://avatars.discourse-cdn.com/v4/letter/j/df788c/32.png) [@josepilove](https://forum.kirupa.com/u/josepilove)\
**Post date:** [March 9, 2009, 3:25pm UTC](https://forum.kirupa.com/t/how-loading-from-xml-and-creating-sprites-based-on-xml-length/283642/1 "2009-03-09T15:25:43Z")

</div>

OK, here is my task. I am supposed to make a film chooser that is an infinite horizontal scroll with stills and stats(name, duration, etc.) filled via XML.

Currently, what i am doing is loading in all of the image URLs from the XML and putting them in an array then accessing them via the array. Then i take and display 5 of them at a time. Then once i get to the edge of my 5 images, i have the images reload -/+ 1 and shift back the width of one image. So as i scroll left and right it is adding an image to one side and taking one away from the other(essentially). It works pretty well, but when i reload the images they go blank and then the new ones pop up. Its kind of hard to explain…

I would like to be able to load all the images at the start and assign each to a sprite, but i do not know how to generate X amount of sprites based on XML length(because films will be added and they want to only update the xml file).
