Copy link to clipboard
Copied
Hi, I don't undertstand why this is working
main script firts frame :
this.on("gameover", function() {
this.gotoAndStop('gameover');
});
with this in a clip :
this.dispatchEvent("gameover", true);
but this function in the main script is not working:
function eval(){
if(clics==maxClics){
this.dispatchEvent("gameover", true);
}
}
thanks and merry christmas
so you can rule out the last option if that's all on the same timeline. these three possible issues remain:
clics may not be defined (in that function)
maxClics may not be defined (in that function)
this may not be defined in that function
use console.log to debug.
Copy link to clipboard
Copied
clics may not be defined (in that function)
maxClics may not be defined (in that function)
this may not be defined in that function
and you may not be dispatching from the correct timeline
Copy link to clipboard
Copied
Hi, first i changed the function name as ClayUUID suggested it. with no better success.
For kglad remarq : this is the whole code, all in the first frame, first level:
this.on("gameover", function() {
this.gotoAndStop('gameover');
});
function evalscore(){
if(clics==maxClics){
this.dispatchEvent("gameover", true);
}
}
function obj_bon(obj) {
score++;
clics++;
evalscore();
}
Copy link to clipboard
Copied
so you can rule out the last option if that's all on the same timeline. these three possible issues remain:
clics may not be defined (in that function)
maxClics may not be defined (in that function)
this may not be defined in that function
use console.log to debug.
Copy link to clipboard
Copied
There's already a global "eval" function in JavaScript. You can't override it.