Hi, I’m working on a dynamically resized photo gallery like everyone else and their mother. Everything works ok so far, until I try to add key detection to complement the previous and next buttons already in place.
When I hit the left or right key it registers, but the picture doesn’t resize the same as if I just press the prev or next buttons. It actually loads the next picture, and then resizes on the follow key hit.
listen = new Object();
listen.onKeyDown = function() {
if (Key.getCode() == Key.LEFT) {
prevImage();
} else if (Key.getCode() == Key.RIGHT) {
nextImage();
}
};
Key.addListener(listen);
prevb.onRelease = function() {
prevImage();
};
nextb.onRelease = function() {
nextImage();
};
function nextImage() {
//curr = current image count, containerMC = picture mc
cur++;
if (cur>pArray.length-1) {
containerMC.loadPic(0);
} else {
containerMC.loadPic(cur);
}
}
function prevImage() {
cur--;
if (cur<0) {
containerMC.loadPic(pArray.length-1);
} else {
containerMC.loadPic(cur);
}
}
Any ideas? Need to see more code?
Thanks :block: