My flash file creates multiple slideshow instances. These slideshow’s are each controlled by some buttons and AS code that reside within the attached container clip. The code for buttons and slideshow nav is as follows (this resides on first frame of attached movie, not on _root):
// next and prev buttons
Prev_btn.onRelease = function() {
prevImage();
};
Next_btn.onRelease = function() {
nextImage();
};
// next and prev functions
prevImage = function() {
//goes to previous image
}
nextImage = function() {
//goes to next image
}
This works fine and when I push these buttons it controls the slideshow that they are part of as expected.
Now, I want to add the option of navigating with the keyboard using arrow keys. I’ve set this up like this:
var keyListener:Object = new Object();
keyListener.onKeyDown = function() {
if (Key.isDown(Key.LEFT)) {
prevImage();
} else if (Key.isDown(Key.RIGHT)) {
nextImage();
} else {
//nothing
}
};
Key.addListener(keyListener);
The problem is that instead of just controlling the slideshow for which you are viewing, the keys control all other slideshows as well at the same time. Where the buttons, when you click them, control only the slideshow that they are contained in.
I’ve tried writing an absolute path to the specific slideshow movie in question like:
_root.theInstanceName.prevImage();
…And it does correctly target only this slideshow, but for some reason targeting it like that completely messes up the prevImage animations–image size, animation timing, etc. is all off.
So I need to find a way that targets only the specific slideshow in question but also plays nicely with my navigation functions. Any ideas?