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…