connect KeyboardEvent to visible false/True button
i use simple script to Hide Prev Button in First Frame and Next Button in Last Frame
Prevbt_forproduct.visible = false;
nextbt_forProduct.addEventListener(MouseEvent.CLICK, fl_ClickToGoToNextFrame);
function fl_ClickToGoToNextFrame(event:MouseEvent):void
{
nextFrame();
Prevbt_forproduct.visible = true;
if(currentFrame == totalFrames){
nextbt_forProduct.visible = false;
}
}
Prevbt_forproduct.addEventListener(MouseEvent.CLICK, fl_ClickToGoToPreviousFrame);
function fl_ClickToGoToPreviousFrame(event:MouseEvent):void
{
prevFrame();
nextbt_forProduct.visible = true;
if(currentFrame == 1){
Prevbt_forproduct.visible = false;
}
}
and i use Keyboard Function for Add Right and Left Key for Go to Next and Prev Frame
import flash.display.Stage;
import flash.events.KeyboardEvent;
import flash.ui.Keyboard
stage.addEventListener(KeyboardEvent.KEY_UP, keyHandler);
function keyHandler(e:KeyboardEvent):void
{
switch(e.keyCode){
case Keyboard.RIGHT: nextFrame();break;
case Keyboard.LEFT:prevFrame();break;
}
}
now The Problem is , when i use Keyboard to Change between Frames the nextbt and Prevbt are not change , in other mean it does not matter how much i press Right or Left key the Prevbt Button Not apear ( frames changes well )
So how can i set a connection between these Scripts ?
thanks
