Ok, so I am creating a slideshow presentation in Flash CS5. The code is very basic, however it does not work as intended. It’s supposed to go to the next frame if i press a button, or press up/right arrow on the keyboard. However, the keyboard only works after I’ve pressed a button once.
my code:
import flash.events.MouseEvent;
import flash.events.KeyboardEvent;
slides.stop();
addEventListener(KeyboardEvent.KEY_DOWN, keyD);
FB.addEventListener(MouseEvent.CLICK, nextSld);
BB.addEventListener(MouseEvent.CLICK, prevSld);
function keyD(evt){
var k = evt.keyCode;
if(k==37||k==38){
prevSld(evt);
}
if(k==39||k==40){
nextSld(evt);
}
}
function nextSld(evt){
slides.nextFrame();
}
function prevSld(evt){
slides.prevFrame();
}
slides is a movieclip, where I’ve stored all my slides (Oh, by the way, I know my setup isn’t the best, but I wouldn’t use a lot of time on it, as it’s for a religion class). FB is forward button, and you can guess what BB is…
Now, I would just make sure my problem isn’t here, and maybe someone can point out the problem, even though this probably don’t fit on this board.
change
addEventListener(KeyboardEvent.KEY_DOWN, keyD);tostage.addEventListener(KeyboardEvent.KEY_DOWN, keyD);