Copy link to clipboard
Copied
In this code, a checkmark appears when each button is clicked. When all 3 buttons are clicked I want the continue arrow to appear. It is on stage, but invisible. I get an error "TypeError: undefined is not an object (evaluating 'this.continueArrow.visible = true')".
this.atmosphere_but.addEventListener("click", fl_ClickToGoToAndStopFromFrame208.bind(this)); var checks = 0; function checkChecks() { //alert(checks); if (checks >=3) { this.continueArrow.visible = true; } } function fl_ClickToGoToAndStopFromFrame208() { this.gotoAndStop(208); this.check1.visible = true; checks = checks+1; checkChecks(); } this.crust_but.addEventListener("click", fl_ClickToGoToAndStopFromFrame209.bind(this)); function fl_ClickToGoToAndStopFromFrame209() { this.gotoAndStop(209); this.check2.visible = true; checks = checks+1; checkChecks(); } this.mantle_but.addEventListener("click", fl_ClickToGoToAndStopFromFrame210.bind(this)); function fl_ClickToGoToAndStopFromFrame210() { this.gotoAndStop(210); this.check3.visible = true; checks = checks+1; checkChecks(); }
"this" isn't defined in checkChecks().
ie, pass a reference from your other functions where it is defined or define a variable that can be used in checkChecks. the former:
function checkChecks(this_var){
//now use "this_var" instead of "this"
}
function yourotherfunctions(){
.
.
checkChecks(this);
}
////////////////////////
the later:
var this_var=this;
function checkChecks(){
//now use "this_var" instead of "this"
}
Copy link to clipboard
Copied
"this" isn't defined in checkChecks().
ie, pass a reference from your other functions where it is defined or define a variable that can be used in checkChecks. the former:
function checkChecks(this_var){
//now use "this_var" instead of "this"
}
function yourotherfunctions(){
.
.
checkChecks(this);
}
////////////////////////
the later:
var this_var=this;
function checkChecks(){
//now use "this_var" instead of "this"
}
Copy link to clipboard
Copied
that worked perfectly. thanks kglad! I'd have never figure that out.
Copy link to clipboard
Copied
you're welcome.
p.s. use console.log to debug and a browser with a developer option so you can see that output. or just use alert() with any browser.
Copy link to clipboard
Copied
Yes i was using the Javscript Console in Safari, which is where it gave me that error. I use a lot of alerts too.
I'm trying to redo a bunch of flash modules that were done years ago before the plugin is completely kaput. Just getting my fee wet with the first one, but have it mostly converted to html5 canvas. thanks again.
Copy link to clipboard
Copied
you're welcome.