Answered
"if" statement problem...
This is maddening, but I must be missing something simple.
First, I have a frame that loads a variable from an ASP page which writes either "&checklist=1" if an email is entered or "&checklist=0" if the email is left blank:
Now on the next frame, I put up dynamic text with the "var" name as "_root.checklist". When the page pulls a "1", the text displays as "1".... when it pulls a "0", it displays a "0". So far, so good.
The problem is, I have a MC on the stage that I only want to be visible if "_root.checklist" is equal to "1". Here's what I came up with:
I've also tried using "onClipEvent(load)" on the MC itself... I've tried taking the function part off, and just keeping it on the main timeline... I've tried putting the "if" statement first... among other things.
Here's a simplified example: Right here
or if you want: Download the files
I'd appreciated any help anyone could give... and I'll probably be slapping myself when I hear the answer.
First, I have a frame that loads a variable from an ASP page which writes either "&checklist=1" if an email is entered or "&checklist=0" if the email is left blank:
quote:
sendVar = new LoadVars();
getVar = new LoadVars();
sendVar.email = email.text;
sendVar.sendAndLoad("send.asp", getVar, "POST");
getVar.onLoad = function(success) {
if (success) {
_root.checklist = this.checklist;
_root.gotoAndPlay("Go");
} else {
_root.response.text = "Error.";
}
Now on the next frame, I put up dynamic text with the "var" name as "_root.checklist". When the page pulls a "1", the text displays as "1".... when it pulls a "0", it displays a "0". So far, so good.
The problem is, I have a MC on the stage that I only want to be visible if "_root.checklist" is equal to "1". Here's what I came up with:
quote:
_root.myMC.onLoad = function(){
if (_root.checklist == 1){
_root.myMC._visible = true;
} else {
_root.myMC._visible = false;
}
}
I've also tried using "onClipEvent(load)" on the MC itself... I've tried taking the function part off, and just keeping it on the main timeline... I've tried putting the "if" statement first... among other things.
Here's a simplified example: Right here
or if you want: Download the files
I'd appreciated any help anyone could give... and I'll probably be slapping myself when I hear the answer.
