2016-12-14 46 views
0

是否有可能通過左鍵單擊進入下一張幻燈片,我只能看到默認的右鍵前進和左鍵向後的按鈕。這是可能的左鍵點擊前進?沒有任何按鈕?actionscript 3演示onclick without buttons

這是默認代碼:

stage.addEventListener(KeyboardEvent.KEY_DOWN, fl_changeSlide); 
function fl_changeSlide(evt:KeyboardEvent):void 
{ 
    if(evt.keyCode == 37) // LEFT 
    { 
    gotoAndStop(this.currentFrame-1); 
    } 
    else if (evt.keyCode == 39 || evt.keyCode == 32) // RIGHT OR SPACE 
    { 
     gotoAndStop(this.currentFrame+1); 
    } 
}stop(); 

回答

2

工作了。

stage.addEventListener(MouseEvent.CLICK, Test); 

function Test(event:MouseEvent):void 
{ 
    gotoAndStop(this.currentFrame+1); 
}stop(); 

感謝您的幫助

+0

你可以簡單地做'nextFrame();'這將進入下一幀並停止播放頭。 'prevFrame();'走向另一個方向 – BadFeelingAboutThis

1
stage.addEventListener(KeyboardEvent.KEY_DOWN, fl_changeSlide); 
function fl_changeSlide(evt:KeyboardEvent):void { 
if(evt.keyCode == 37) // LEFT 
{ 
gotoAndStop(this.currentFrame+1); 
} 
else if (evt.keyCode == 39 || evt.keyCode == 32) // RIGHT OR SPACE 
{ 
    gotoAndStop(this.currentFrame-1); 
} }stop(); 
+0

這仍然只是按鍵板印刷機,有沒有對鼠標左鍵的選項點擊前進或後退,而無需使用按鈕? –

+1

stage.addEvevtListener(MouseEvent.Click,fl_changeSlide); – suzuiyue