|
-
If... Else statement, in Flash 4
I am trying to make this code I got from a tutorial to work on MX, but having trouble... can anybody help? Just need the proper structure of if else if else and I will be on my way. 
code:
on (release) {
if (!form-email.length || submit-email.indexOf("@") == -1 || Email.indexOf(".") == -1) {
EmailStatus = "Please enter a valid E-mail address";
}
else if (!form-name.length) {
EmailStatus = "Please enter your name";
}
}
else if (!form-subject.length) {
EmailStatus = "Please enter a topic";
}
else if (!form-body.length) {
EmailStatus = "Please enter your comment";
}
else {
loadVariablesNum ("snowMailPHP.php", "0", "Post");
EmailStatus = "Delivering eMail...";
}
}
EDIT: Added [ as ] tags - see posting guidelines at the top of the forum. jbum
Last edited by jbum; 10-15-2004 at 05:33 PM.
-
Senior Member
Looks like you had a stray right-curly-bracket in there, after the first else clause. This was terminating your on(release) handler, and causing the remaining else clauses to fall outside of the event handler (and trigger syntax errors, no doubt).
Consistently indenting your code will make this kind of thing easier to spot.
code:
on (release) {
if (!form-email.length || submit-email.indexOf("@") == -1 || Email.indexOf(".") == -1) {
EmailStatus = "Please enter a valid E-mail address";
}
else if (!form-name.length) {
EmailStatus = "Please enter your name";
}
else if (!form-subject.length) {
EmailStatus = "Please enter a topic";
}
else if (!form-body.length) {
EmailStatus = "Please enter your comment";
}
else {
loadVariablesNum ("snowMailPHP.php", "0", "Post");
EmailStatus = "Delivering eMail...";
}
}
Last edited by jbum; 10-15-2004 at 05:39 PM.
-
Thanks a bunch! I was scratching my head and wondering why they'd change the basic If statements.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|