出于某种奇怪的原因,我让它工作了。这段代码是在开头添加的,而不是像我上次那样在结尾添加。这是我所做的:
var DAY = 0;
stage.addEventListener(Event.ENTER_FRAME, newDayFunc);
function newDayFunc(event:Event) {
if (currentFrame == 1286) {
if (Moon.hitTestObject(wallNewDay)) {
DAY++;
dayTextField.text = DAY;
trace("What day it is:", DAY);
}
}
}
**这是我在弄清楚一些事情后最终使用的,呵呵:
// I figured it out. This is on the last frame.
// Variables
var DAY = 0;
//
// Listeners
stage.addEventListener(Event.ENTER_FRAME, newDayFunc);
//
// Functions
function newDayFunc(event:Event) {
if (DAY < 7)) {
DAY++;
dayTextField.text = DAY;
trace("What day it is:", DAY);
stage.removeEventListener(Event.ENTER_FRAME, newDayFunc);
} else {
// Added other eventListeners that needed to be removed
gotoAndStop("finished"); // The name of the finish frame
}
}
//