# Please help/ as3 load images into an array from xml

**URL:** <https://forum.kirupa.com/t/please-help-as3-load-images-into-an-array-from-xml/275176>\
**Category:** Uncategorized\
**Created:** [November 10, 2008, 9:35pm UTC](https://forum.kirupa.com/t/please-help-as3-load-images-into-an-array-from-xml/275176 "2008-11-10T21:35:04Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![wuzzi2ya](https://avatars.discourse-cdn.com/v4/letter/w/e79b87/32.png) [@wuzzi2ya](https://forum.kirupa.com/u/wuzzi2ya)\
**Post date:** [November 10, 2008, 9:35pm UTC](https://forum.kirupa.com/t/please-help-as3-load-images-into-an-array-from-xml/275176/1 "2008-11-10T21:35:04Z")

</div>

Code below:

photos.stop();

var startX:Number;  
var startFrame:int;  
var changeDistance:int;  
var travelDistance:int;

photos.buttonMode = true;  
photos.addEventListener(MouseEvent.MOUSE\_DOWN, pressHandler);

function pressHandler(evt:MouseEvent):void {  
startX = photos.mouseX;  
startFrame = photos.currentFrame;  
photos.addEventListener(MouseEvent.MOUSE\_MOVE, moveHandler);  
stage.addEventListener(MouseEvent.MOUSE\_UP, releaseHandler);  
}

function releaseHandler(evt:MouseEvent):void {  
photos.removeEventListener(MouseEvent.MOUSE\_MOVE, moveHandler);  
stage.removeEventListener(MouseEvent.MOUSE\_UP, releaseHandler);  
}

function moveHandler(evt:MouseEvent):void {  
changeDistance = Math.round((photos.mouseX - startX) / 4);  
travelDistance = startFrame + changeDistance;  
if (travelDistance \> photos.totalFrames) {  
photos.gotoAndStop(travelDistance % photos.totalFrames);  
} else if (travelDistance \< 0) {  
photos.gotoAndStop(photos.totalFrames + (travelDistance % photos.totalFrames));  
} else {  
photos.gotoAndStop(travelDistance);  
}  
}

* * *

Photos is a movie clip created on the stage. Within photos is a series of sequential images placed on their own keyframes. I would like to load these images in through an xml file, and I would like to load them into an array while keeping all of the functionality of the (photos) movie clip… I understand the concept of arrays (not difficult) and I understand xml (less difficult), but I am not in the know or at least I am overlooking the obviuos, of how to combine the 2…

Can anyone help me with this? Thanks for all the great help from Kirupa and its participants…
