onKeyDown issue

it’s about a gallery -

previous and next buttons r working correctly, just like

tArray = [];
pArray = [];
iArray = [];

so I tried to implement

listen = new Object();
listen.onKeyDown = function() {
if (Key.getCode() == Key.LEFT) {
prevImage();
} else if (Key.getCode() == Key.RIGHT) {
nextImage();
}
};
Key.addListener(listen);

and when pressing the arrow keys it doesn’t load the apropriate image!!

The function is the same for the previous and next buttons - so
where’s the catch…

What happens with the images is - on the first KeyDown.RIGHT it goes to
the correct image, on the second it goes back to the first image - and ond the third it skips two images ahead, and likewise for the KeyDown.LEFT.

Is it a matter of removing the listener - and where?

thanx for your time - tonni