For my semester final, I’m having students build an app in App Lab. Two students are working together on their code, and have the same block of code, but it will throw exceptions for one student and not the other.
The exceptions are:
ERROR: Line: 194: Error: setText() id parameter refers to an id ("") which is already being used outside of App Lab. Please use a different id.
ERROR: Line: 195: Error: getXPosition() id parameter refers to an id ("") which is already being used outside of App Lab. Please use a different id.
The code throwing the errors is (I added comment code to show which lines are the issue):
function timer (event) {
if (event.srcElementId == “Lvl_1”) {
timerSet = “timeInput1”;
}else if (event.srcElementId == “Lvl_2”) {
timerSet = “timeInput2”;
}
timedLoop(1000, function() {
time --;
console.log(time);
console.log(timerSet);
// Line 194:
setText(timerSet, time);
// Line 195:
if (getXPosition(lvl_1_sprite) >= 320) {
stopTimedLoop();
scoring(event);
}
});
}
I’ve tried changing the name of the lvl_1_sprite variable, but so far have had no luck helping him and I’m not really sure what steps to take from here. Any help is appreciated.
Thanks!