2014-03-01 84 views
0

我是全新的Flash CS6動作腳本3.我必須做一個場景的分配,必須有鼠標,鍵盤,輸入框和時間事件。每次我測試電影時,我都會收到一個錯誤,指出'關於'輸入框架事件'和'定時器事件'功能'的重複函數定義'。我試圖重新命名這些函數,但它不起作用。還有其他解決方案嗎?另外,你可以舉一些例子嗎?謝謝!如何解決這個重複的函數定義錯誤?

QuestionMC.addEventListener(MouseEvent.CLICK, onClick); 
QuestionMC.addEventListener(MouseEvent.ROLL_OVER, questionOver); 
QuestionMC.addEventListener(MouseEvent.ROLL_OUT, questionOut); 

function questionOver(event:MouseEvent):void 
{ 
    event.target.alpha = .5; 
} 

function questionOut(event:MouseEvent):void 
{ 
    event.target.alpha = 1; 
} 

function onClick(event:MouseEvent):void 
{ 
    //trace("click!!!"); 
    event.target.y -= 15; 
    event.target.rotation += 45; 
} 

QuestionMC.buttonMode = true; 

stage.addEventListener(KeyboardEvent.KEY_DOWN, jump); 
stage.addEventListener(KeyboardEvent.KEY_UP, land); 

function jump (event:KeyboardEvent): void 
{ 
    trace(event.keyCode); 
    YoshiMC.y -= 50 
    stage.removeEventListener(KeyboardEvent.KEY_DOWN, jump); 
    stage.addEventListener(Event.ENTER_FRAME, flip); 
} 
function land (event:KeyboardEvent): void 
{ 
    YoshiMC.y += 50 
    stage.addEventListener(KeyboardEvent.KEY_DOWN, jump); 
    stage.removeEventListener(Event.ENTER_FRAME, flip); 
} 
function flip(event:Event):void 
{ 
    YoshiMC.rotation += 45; 
    YoshiMC.x += 20; 
} 
var jumpTimer:Timer = new Timer(5000,1); 
jumpTimer.addEventListener(TimeEvent.TIMER, jump); 
function jump (event:TimerEvent):void 
{ 
    planteaterMC.play(); 
} 
jumpTimer.start(); 

var link:URLRequest = new URLRequest(""); 

buttongoeshere.addEventListener(MouseEvent.CLICK, clickHere); 

function clickHere(event:MouseEvent):void 
{ 
    navigateToURL(link); 
} 
buttongoeshere.buttonMode = true; 
+0

任何一個? – user3369167

回答

0

jump函數聲明爲兩次,在這裏:

function jump (event:KeyboardEvent): void 

這裏:

function jump (event:TimerEvent):void 

你只需要在所有的重命名其中一個

相關問題