Skip navigation
Currently Being Moderated

as3 load images into an array from xml

Nov 10, 2008 3:02 PM

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?
 
Replies

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points