Hi all,
I’ve been trying to make a slide show that pans left-right and vice versa. My idea is to have empty movie clips create based on the number of images in an array (so that later i can try parsing from xml). The created movie clips would be inside a container that slides left or right. each time the container slides the movie clip in the first position of the array would swap to the back of the array (or last position to the first depending on the direction the container is sliding).
the problem that i’m having is when i click too fast i can’t get the sliding and swapping in sync after i added easing to the slide show. i either get the swapping faster than the distance moved by the container or the distance to move farther than the pace swapping.
here’s an example of what i have so far
myImgArray = new Array();
for (i=0; i<totalImg; i++) {
this.createEmptyMovieClip("imgClip"+i, i);
curClip = eval("imgClip"+i);
curClip._x = imageWidth*i;
curClip.loadMovie(image*);
myImgArray.push(curClip);
}
slideSpring = .5;
slideDamping = .35;
slideSpeed = 0;
function moveMyContainerL() {
var xPos = this._x-imageWidth;
this.onEnterFrame = function() {
var slideDelta = (xPos - this._x) * slideSpring;
if (Math.abs(xPos - this._x)<1) {
this._x = xPos;
delete (this.onEnterFrame);
} else {
this._x -= this.slideSpeed/3;
this.slideSpeed = this.slideSpeed * slideDamping - slideDelta;
}
}
pushClip();
}
p = 0;
function pushClip() {
myImgArray.push(myImgArray[0]);
myImgArray[myImgArray.length-1]._x = (imageWidth*totalImg)+(imageWidth*p);
myImgArray.shift();
p++;
}
i’ve also attached the source file. please take a look. Thanks!