我可以知道为什么我需要在函数 returnToInput 中再次添加“ComputeBtn.addEventListener(MouseEvent.CLICK,computeLoan)”,否则第 1 帧的按钮 ComputeBtn 将不再起作用。我没有删除监听器。只需转到第二帧显示结果并返回第一帧输入数据。
package {
import flash.display.*;
import flash.events.*;
//THE CLASS DEFINITION
public class carApp extends MovieClip {
function carApp() {
gotoAndStop(1);
ComputeBtn.addEventListener(MouseEvent.CLICK,computeLoan);
}
function computeLoan(event:MouseEvent) {
gotoAndStop(2);
trace("Show result");
StartAgainBtn.addEventListener(MouseEvent.CLICK,returnToInput);
}
function returnToInput(event:MouseEvent) {
gotoAndStop(1);
ComputeBtn.addEventListener(MouseEvent.CLICK,computeLoan);
}
}
}