if and else statements  
Author Message
Alex Hunsley





PostPosted: 2003-12-11 18:36:00 Top

java-programmer, if and else statements David Postill wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> In article <email***@***.com>, on Wed, 10 Dec 2003 15:09:18 -0500, "Dale King"
> <email***@***.com> wrote:
>
> | "Devin Panchal" <email***@***.com> wrote in message
> | news:2uHBb.2124$email***@***.com...
> | > calm down man. i'm not angry.
> | > i reckon u guys r the soundest people ever. if i came across as angry,
> | then
> |
> | Go back and read your posts. You basically cussed out Thomas for simply
> | pointing out very politely that you should cross-post not multi-post.
> |
> | > i'm sorry. i just dont see y evry1 gotta start this big chain of emails,
> | > just cos i did a multi-post. i mean come on man. does it really matter? is
> | > it really worth losing sleep over?
> | > y dont ya'll chill out? yor like a bunch of whining babies. someone else
> | > will do it tomorow. i made a mistake, i'll try not to do it again. ;)
> |
> | Once again everyone is not upset that you multi-posted instead of
> | cross-posted. That is a common occurrence and when it happens someone will
> | very kindly tell the newbie that they should cross-post instead and that it
> | is better for all involved.
> |
> | What everyone is upset about is YOUR reaction to being told that you should
> | cross post and your attitude that basically says have a right to demand
> | help. You receive help as a favor from other people. No one here is getting
> | paid to answer your questions. Therefore you should be respectful of others.
> | You can show that respect by being considerate of their time by not
> | multi-posting. And you also show respect by listening to what they tell you.
> | If someone tells you that it is a bad idea to multi-post you don't cuss them
> | out. As others have said, if you don't respect others in the group, then you
> | are less likely to receive assistance in the future.
>
> Hmm. Well he is only 17 so what do you expect? The youth of today just don't
> have any manners <grin>.
>
> And he can't even get his own name right. It is "Sunit" not "Devin".
>
> He wants to be an airline pilot...
>
> And he lives in Coventry.

Airline pilot?
<shudder>

<images scenario:>

SUNIT: Air traffic control, this iz Sunit 571 coming in 4 landing.

ATC: Sunit 571, you haven't received clearance to land.

SUNIT: I need 2 land!!!!!!!!! I don't give a sh1t about th0se other planes.

ATC: Denied. Go into circling pattern west of approach.

SUNIT: u bunch of whining babies. all i want 2 do is land. I am coming
in2 land now.

[CRUNCH! 700 people die]

SUNIT is led from the smoking wreckage, having a tantrum.

SUNIT: waaaaaaaaaah!

POLICE: I am arresting you for willful negligence and violation of the
aviation act 1937.

SUNIT: whas u'r problem u big baby? i got 2 land! i got 2 laaaaand!!!
thx for u'r help anyway.


SUNIT is led to a police cell and taught the manners his mother forgot.




































 
Alex Hunsley





PostPosted: 2003-12-11 18:36:00 Top

java-programmer >> if and else statements David Postill wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> In article <email***@***.com>, on Wed, 10 Dec 2003 15:09:18 -0500, "Dale King"
> <email***@***.com> wrote:
>
> | "Devin Panchal" <email***@***.com> wrote in message
> | news:2uHBb.2124$email***@***.com...
> | > calm down man. i'm not angry.
> | > i reckon u guys r the soundest people ever. if i came across as angry,
> | then
> |
> | Go back and read your posts. You basically cussed out Thomas for simply
> | pointing out very politely that you should cross-post not multi-post.
> |
> | > i'm sorry. i just dont see y evry1 gotta start this big chain of emails,
> | > just cos i did a multi-post. i mean come on man. does it really matter? is
> | > it really worth losing sleep over?
> | > y dont ya'll chill out? yor like a bunch of whining babies. someone else
> | > will do it tomorow. i made a mistake, i'll try not to do it again. ;)
> |
> | Once again everyone is not upset that you multi-posted instead of
> | cross-posted. That is a common occurrence and when it happens someone will
> | very kindly tell the newbie that they should cross-post instead and that it
> | is better for all involved.
> |
> | What everyone is upset about is YOUR reaction to being told that you should
> | cross post and your attitude that basically says have a right to demand
> | help. You receive help as a favor from other people. No one here is getting
> | paid to answer your questions. Therefore you should be respectful of others.
> | You can show that respect by being considerate of their time by not
> | multi-posting. And you also show respect by listening to what they tell you.
> | If someone tells you that it is a bad idea to multi-post you don't cuss them
> | out. As others have said, if you don't respect others in the group, then you
> | are less likely to receive assistance in the future.
>
> Hmm. Well he is only 17 so what do you expect? The youth of today just don't
> have any manners <grin>.
>
> And he can't even get his own name right. It is "Sunit" not "Devin".
>
> He wants to be an airline pilot...
>
> And he lives in Coventry.

Airline pilot?
<shudder>

<images scenario:>

SUNIT: Air traffic control, this iz Sunit 571 coming in 4 landing.

ATC: Sunit 571, you haven't received clearance to land.

SUNIT: I need 2 land!!!!!!!!! I don't give a sh1t about th0se other planes.

ATC: Denied. Go into circling pattern west of approach.

SUNIT: u bunch of whining babies. all i want 2 do is land. I am coming
in2 land now.

[CRUNCH! 700 people die]

SUNIT is led from the smoking wreckage, having a tantrum.

SUNIT: waaaaaaaaaah!

POLICE: I am arresting you for willful negligence and violation of the
aviation act 1937.

SUNIT: whas u'r problem u big baby? i got 2 land! i got 2 laaaaand!!!
thx for u'r help anyway.


SUNIT is led to a police cell and taught the manners his mother forgot.




































 
Alex Hunsley





PostPosted: 2003-12-11 18:39:00 Top

java-programmer >> if and else statements David Postill wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> In article <email***@***.com>, on Wed, 10 Dec 2003 15:09:18 -0500, "Dale King"
> <email***@***.com> wrote:
>
> | "Devin Panchal" <email***@***.com> wrote in message
> | news:2uHBb.2124$email***@***.com...
> | > calm down man. i'm not angry.
> | > i reckon u guys r the soundest people ever. if i came across as angry,
> | then
> |
> | Go back and read your posts. You basically cussed out Thomas for simply
> | pointing out very politely that you should cross-post not multi-post.
> |
> | > i'm sorry. i just dont see y evry1 gotta start this big chain of emails,
> | > just cos i did a multi-post. i mean come on man. does it really matter? is
> | > it really worth losing sleep over?
> | > y dont ya'll chill out? yor like a bunch of whining babies. someone else
> | > will do it tomorow. i made a mistake, i'll try not to do it again. ;)
> |
> | Once again everyone is not upset that you multi-posted instead of
> | cross-posted. That is a common occurrence and when it happens someone will
> | very kindly tell the newbie that they should cross-post instead and that it
> | is better for all involved.
> |
> | What everyone is upset about is YOUR reaction to being told that you should
> | cross post and your attitude that basically says have a right to demand
> | help. You receive help as a favor from other people. No one here is getting
> | paid to answer your questions. Therefore you should be respectful of others.
> | You can show that respect by being considerate of their time by not
> | multi-posting. And you also show respect by listening to what they tell you.
> | If someone tells you that it is a bad idea to multi-post you don't cuss them
> | out. As others have said, if you don't respect others in the group, then you
> | are less likely to receive assistance in the future.
>
> Hmm. Well he is only 17 so what do you expect? The youth of today just don't
> have any manners <grin>.
>
> And he can't even get his own name right. It is "Sunit" not "Devin".
>
> He wants to be an airline pilot...
>
> And he lives in Coventry.

... and:

"I am in the A.T.C and have reached the rank of sergeant."

Aeeeiii! Maybe his rank makes us all 'worms' and that's why he can
badmouth usenet whenever he likes! I get it now!







 
 
Alex Hunsley





PostPosted: 2003-12-11 18:42:00 Top

java-programmer >> if and else statements David Postill wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> In article <email***@***.com>, on Wed, 10 Dec 2003 15:09:18 -0500, "Dale King"
> <email***@***.com> wrote:
>
> | "Devin Panchal" <email***@***.com> wrote in message
> | news:2uHBb.2124$email***@***.com...
> | > calm down man. i'm not angry.
> | > i reckon u guys r the soundest people ever. if i came across as angry,
> | then
> |
> | Go back and read your posts. You basically cussed out Thomas for simply
> | pointing out very politely that you should cross-post not multi-post.
> |
> | > i'm sorry. i just dont see y evry1 gotta start this big chain of emails,
> | > just cos i did a multi-post. i mean come on man. does it really matter? is
> | > it really worth losing sleep over?
> | > y dont ya'll chill out? yor like a bunch of whining babies. someone else
> | > will do it tomorow. i made a mistake, i'll try not to do it again. ;)
> |
> | Once again everyone is not upset that you multi-posted instead of
> | cross-posted. That is a common occurrence and when it happens someone will
> | very kindly tell the newbie that they should cross-post instead and that it
> | is better for all involved.
> |
> | What everyone is upset about is YOUR reaction to being told that you should
> | cross post and your attitude that basically says have a right to demand
> | help. You receive help as a favor from other people. No one here is getting
> | paid to answer your questions. Therefore you should be respectful of others.
> | You can show that respect by being considerate of their time by not
> | multi-posting. And you also show respect by listening to what they tell you.
> | If someone tells you that it is a bad idea to multi-post you don't cuss them
> | out. As others have said, if you don't respect others in the group, then you
> | are less likely to receive assistance in the future.
>
> Hmm. Well he is only 17 so what do you expect? The youth of today just don't
> have any manners <grin>.
>
> And he can't even get his own name right. It is "Sunit" not "Devin".
>
> He wants to be an airline pilot...
>
> And he lives in Coventry.
>
>
> <davidp />
>

He's actually been posting on usenet since Oct 2001. Stunningly, not
managed to learn basic nettiquette (or not willing) in that time...



 
 
Devin Panchal





PostPosted: 2003-12-11 23:44:00 Top

java-programmer >> if and else statements lol. i reckon some of ya'll are imature. i said i'm sorry, wat else do u
want me to do? theres no need to hack into my e mail, etc. bring up my
details, etc. and blame my parents. my parents are dead! :(
wat ya'll said is really out of order. 'saying i dont give a shit', aint as
bad as blaming my parents, and bringing my family into it.

i dont know wat else to say to make everything square. i think yor all
blowing this way out of proportion. dont u? anywayx how did u get my emails?
that was kinda cool!!


"Alex Hunsley" <email***@***.com> wrote in message
news:email***@***.com...
> David Postill wrote:
>
> > -----BEGIN PGP SIGNED MESSAGE-----
> > Hash: SHA1
> >
> > In article <email***@***.com>, on Wed, 10 Dec 2003 15:09:18 -0500,
"Dale King"
> > <email***@***.com> wrote:
> >
> > | "Devin Panchal" <email***@***.com> wrote in message
> > | news:2uHBb.2124$email***@***.com...
> > | > calm down man. i'm not angry.
> > | > i reckon u guys r the soundest people ever. if i came across as
angry,
> > | then
> > |
> > | Go back and read your posts. You basically cussed out Thomas for
simply
> > | pointing out very politely that you should cross-post not multi-post.
> > |
> > | > i'm sorry. i just dont see y evry1 gotta start this big chain of
emails,
> > | > just cos i did a multi-post. i mean come on man. does it really
matter? is
> > | > it really worth losing sleep over?
> > | > y dont ya'll chill out? yor like a bunch of whining babies. someone
else
> > | > will do it tomorow. i made a mistake, i'll try not to do it again.
;)
> > |
> > | Once again everyone is not upset that you multi-posted instead of
> > | cross-posted. That is a common occurrence and when it happens someone
will
> > | very kindly tell the newbie that they should cross-post instead and
that it
> > | is better for all involved.
> > |
> > | What everyone is upset about is YOUR reaction to being told that you
should
> > | cross post and your attitude that basically says have a right to
demand
> > | help. You receive help as a favor from other people. No one here is
getting
> > | paid to answer your questions. Therefore you should be respectful of
others.
> > | You can show that respect by being considerate of their time by not
> > | multi-posting. And you also show respect by listening to what they
tell you.
> > | If someone tells you that it is a bad idea to multi-post you don't
cuss them
> > | out. As others have said, if you don't respect others in the group,
then you
> > | are less likely to receive assistance in the future.
> >
> > Hmm. Well he is only 17 so what do you expect? The youth of today just
don't
> > have any manners <grin>.
> >
> > And he can't even get his own name right. It is "Sunit" not "Devin".
> >
> > He wants to be an airline pilot...
> >
> > And he lives in Coventry.
> >
> >
> > <davidp />
> >
>
> He's actually been posting on usenet since Oct 2001. Stunningly, not
> managed to learn basic nettiquette (or not willing) in that time...
>
>
>


 
 
Christophe Vanfleteren





PostPosted: 2003-12-12 0:07:00 Top

java-programmer >> if and else statements Devin Panchal wrote:

> lol. i reckon some of ya'll are imature. i said i'm sorry, wat else do u
> want me to do? theres no need to hack into my e mail, etc. bring up my
> details, etc. and blame my parents. my parents are dead! :(
> wat ya'll said is really out of order. 'saying i dont give a shit', aint
> as bad as blaming my parents, and bringing my family into it.
>
> i dont know wat else to say to make everything square. i think yor all
> blowing this way out of proportion. dont u?

You might want to try to apologize, instead of (once again) attacking the
people who replied to you. You seem to think the problem lies with everyone
else instead of you.

> anywayx how did u get my
> emails? that was kinda cool!!

Fear the l33t google skills of this group.

As an aside, please learn to type properly. You really sound like a some
random moron when you type like that. It's not like English is such a
foreign language to you, since you're from the UK.

--
Kind regards,
Christophe Vanfleteren
 
 
Alex Hunsley





PostPosted: 2003-12-12 0:19:00 Top

java-programmer >> if and else statements Devin Panchal wrote:

> lol. i reckon some of ya'll are imature. i said i'm sorry, wat else do u
> want me to do?

No, you said sorry for multiposting. You didn't apologise for blowing up
and cussing someone out for mentioning good netiquette to you.

> theres no need to hack into my e mail,

Who do you think has hacked into your email? I certainly haven't.

> etc. bring up my
> details, etc. and blame my parents. my parents are dead! :(

No disrespect to you parents intended. If you're rude to others, don't
be surprised when they're rude back, that's all.

> wat ya'll said is really out of order. 'saying i dont give a shit', aint as
> bad as blaming my parents, and bringing my family into it.

Then let your family be proud of you by being a model netizen!
If you notice, the people posting here who *aren't* rude are received
with courtesy and respect. What goes around, comes around.
No-one is paid to read these groups and help people. They do it because
they're happy to share what they know and help other people out, but
only if there is some respect involved.

> i dont know wat else to say to make everything square. i think yor all
> blowing this way out of proportion. dont u?

Nope, I think the reaction to your rudeness was understandable. This
isn't about multiposting any more, it's about your rudeness to someone
politely requesting that you follow netiquette. See?

> anywayx how did u get my emails?
> that was kinda cool!!

I didn't 'get' any of your emails. You haven't been hacked. Hint:
groups.google.com.
(I wouldn't think it was cool if I thought my emails were accessed - I
would be concerned! But as I say, no-one has hacked you.)







 
 
Devin Panchal





PostPosted: 2003-12-12 0:22:00 Top

java-programmer >> if and else statements i've said i'm sorry serveral times. i'll say it again. SORRY! can u put my e
mail all back to normal. cos i aint receieving any? theres no need to stop
my e mail.


"Christophe Vanfleteren" <email***@***.com> wrote in message
news:nC0Cb.72605$email***@***.com...
> Devin Panchal wrote:
>
> > lol. i reckon some of ya'll are imature. i said i'm sorry, wat else do u
> > want me to do? theres no need to hack into my e mail, etc. bring up my
> > details, etc. and blame my parents. my parents are dead! :(
> > wat ya'll said is really out of order. 'saying i dont give a shit', aint
> > as bad as blaming my parents, and bringing my family into it.
> >
> > i dont know wat else to say to make everything square. i think yor all
> > blowing this way out of proportion. dont u?
>
> You might want to try to apologize, instead of (once again) attacking the
> people who replied to you. You seem to think the problem lies with
everyone
> else instead of you.
>
> > anywayx how did u get my
> > emails? that was kinda cool!!
>
> Fear the l33t google skills of this group.
>
> As an aside, please learn to type properly. You really sound like a some
> random moron when you type like that. It's not like English is such a
> foreign language to you, since you're from the UK.
>
> --
> Kind regards,
> Christophe Vanfleteren


 
 
Christophe Vanfleteren





PostPosted: 2003-12-12 0:28:00 Top

java-programmer >> if and else statements Devin Panchal wrote:

> i've said i'm sorry serveral times. i'll say it again. SORRY! can u put my
> e mail all back to normal. cos i aint receieving any? theres no need to
> stop my e mail.

I really doubt anyone here is stopping you from getting your email. And even
if someone is mailicous enough to do that, it certainly isn't me.

--
Kind regards,
Christophe Vanfleteren
 
 
Devin Panchal





PostPosted: 2003-12-12 1:11:00 Top

java-programmer >> if and else statements ok, if it makes u happy. i'm sorry. but its kinda sad to search my details,
and look where ever i have posted. i mean u must have better things to do,
cos i know i have. if u check all of my posts, i am never rude. it just
happened on this occasion cos i was stressed and i didnt see a big deal
about multi-posting. theres no need to start making stories, its just out of
order. if it did happen, u wish u didint say a thing like that.

also the stuff u said about being a pilot, etc. thats not me. thats my
little brother!! u got the info on the wrong person. my bro uses my e mail
address. that was out of order wat u said about him. hes got his 1st exam
next week! hes read this whole chain, and hes upset, how every1 turned it
upside down.


"Alex Hunsley" <email***@***.com> wrote in message
news:email***@***.com...
> Devin Panchal wrote:
>
> > lol. i reckon some of ya'll are imature. i said i'm sorry, wat else do u
> > want me to do?
>
> No, you said sorry for multiposting. You didn't apologise for blowing up
> and cussing someone out for mentioning good netiquette to you.
>
> > theres no need to hack into my e mail,
>
> Who do you think has hacked into your email? I certainly haven't.
>
> > etc. bring up my
> > details, etc. and blame my parents. my parents are dead! :(
>
> No disrespect to you parents intended. If you're rude to others, don't
> be surprised when they're rude back, that's all.
>
> > wat ya'll said is really out of order. 'saying i dont give a shit', aint
as
> > bad as blaming my parents, and bringing my family into it.
>
> Then let your family be proud of you by being a model netizen!
> If you notice, the people posting here who *aren't* rude are received
> with courtesy and respect. What goes around, comes around.
> No-one is paid to read these groups and help people. They do it because
> they're happy to share what they know and help other people out, but
> only if there is some respect involved.
>
> > i dont know wat else to say to make everything square. i think yor all
> > blowing this way out of proportion. dont u?
>
> Nope, I think the reaction to your rudeness was understandable. This
> isn't about multiposting any more, it's about your rudeness to someone
> politely requesting that you follow netiquette. See?
>
> > anywayx how did u get my emails?
> > that was kinda cool!!
>
> I didn't 'get' any of your emails. You haven't been hacked. Hint:
> groups.google.com.
> (I wouldn't think it was cool if I thought my emails were accessed - I
> would be concerned! But as I say, no-one has hacked you.)
>
>
>
>
>
>
>


 
 
Alex Hunsley





PostPosted: 2003-12-12 22:28:00 Top

java-programmer >> if and else statements Devin Panchal wrote:

> ok, if it makes u happy. i'm sorry.

Well that's a pretty half-arsed apology. People are usually sorry
because they realised they did something out of order, rather than sorry
because it will make someone else happy.

And this isn't just about me, it's about the other people using usenet
apart from yourself, and about getting the most out of usenet, which you
you can best do by a) being polite, b) following the guidelines of usenet.
I *presume* you want to get the most out of usenet you can...

> but its kinda sad to search my details,
> and look where ever i have posted. i mean u must have better things to do,
> cos i know i have.

Well, if someone comes into a group and is rude it's kind of hard to
resist finding out what else they've posted. If you're not rude, you
won't draw attention to yourself.

> if u check all of my posts, i am never rude.

Yes, but the first impression you made to readers of this group was of
rudeness. People tend not to react to your whole posting history, but to
your post on that one occaison, especially if it's rude.

> it just
> happened on this occasion cos i was stressed and i didnt see a big deal
> about multi-posting.

You didn't see a big deal, but other, more seasoned users of usenet saw
someone doing something counter-productive (multi-posting) and offered
the suggestion of doing things differently. The real "big deal" was
about your reaction to helpful suggestions.

> theres no need to start making stories, its just out of
> order. if it did happen, u wish u didint say a thing like that.
>
> also the stuff u said about being a pilot, etc. thats not me. thats my
> little brother!! u got the info on the wrong person. my bro uses my e mail
> address. that was out of order wat u said about him. hes got his 1st exam
> next week! hes read this whole chain, and hes upset, how every1 turned it
> upside down.

Oh, ok, apologies to your brother.

Now, are we learning something? Like, perhaps if you'd been polite in
the first place, this whole discussion wouldn't be going on? You'd have
got some answers to your questions and that would have been that.





 
 
Mr.Wallace





PostPosted: 2008-6-13 2:23:00 Top

java-programmer >> if and else statements Man...I'm so close to figuring this out and I didn't want to have to come back
to forum for this because I've had a couple topics on here already when I was
starting this project and half way through it and now towards the end of it,
LOL! I hope y'all don't mind!?

Anyways...

Now, I'm trying to get users to fill in 4 input boxes with the correct info,
then hit the ENTER key to proceed to the next frame. Everything is working
perfectly with that part of my code, however, it's the part about if they enter
in the wrong info that I'm getting stumped on.

I've tried ELSE statements and various forms of listeners and IF statements
but I just can't seem to get it to work.

When they enter in the wrong info, in any of the input boxes, I need to to be
taken to a different frame. I had a script in there that kind of worked but
instead of it waiting until they entered in all the info, it would just go
automatically to the "wrong" frame because technically they were only getting a
chance to enter in the first letter of the first word.

Anyways, the code I'm using now is attached. It works fine except the part of
the wrong info being entered. If a user just comes to this frame (where this
code is located) and hits ENTER, thn they are taken to the "Incorrect" frame,
which is fine because technically they didn't enter anything into the 4 boxes.
But. if they did start typing into a box and then hit ENTER, they should be
taken to the same "Incorrect" frame because they didn't enter everything, but
it doesn't do that. Even if they enter info into every box and one letter is
missing for example, that's wrong and should go to that "Incorrect" page, but
doesn't.

Any ideas?

Selection.setFocus(name);

var listener:Object = new Object();

listener.onKeyDown = function():Void {
if (box1.text == "info1" && box2.text == "info2" && box3.text == "info3" &&
box4.text == "info4" && Key.isDown(Key.ENTER)) {
gotoAndStop("Correct");
}
}

Key.addListener(listener);


var listener:Object = new Object();

listener.onKeyDown = function():Void {
if (box1.text !== "info1" && box2.text !== "info2" && box3.text !== "info3" &&
box4.text !== "info4" && Key.isDown(Key.ENTER)) {
gotoAndStop("Incorrect");
}
}

Key.addListener(listener);

 
 
Rothrock





PostPosted: 2008-6-13 3:06:00 Top

java-programmer >> if and else statements Well I think you are going to have some problems because you are using two
listeners and they are overwriting each other. But I think you need to take a
different approach in any event. Since you aren't trying to validate as you go,
the only thing you really need to listen for is the enter key, when that is
pressed you can check to see if things are correct and respond accordingly. So
make your listener:

var listener:Object=new Object();
listener.onKeyDown=function(){
if (Key.isDown(Key.ENTER)){
evaluate();
}
}

So only when the enter key is pressed will we call the evaluate function. So
now you coudl use something like this:

function evaluate(){
if(box1.text==""info1" && box2.text=="info2" && so on){
trace ("correct");
} else {
trace("incorrect");
}
}

Notice I don't need to check for the incorrectness. If it isn't correct then
it is incorrect. Also the code you gave above for your incorrect conditional is
not right. You are using ands which mean that box1 is not info1 and box2 is not
info2 and so on. So in effect your second conditional is only true if all of
them are wrong. I think you would want || (which means OR). That way if any of
them are wrong the statement is true. But as I said you don't need to check
that in this case.

But here is another one for you. What if suddenly you have to add two new text
boxes to this? The conditional get hairier and hairier. So a different approach
could be something like this. Change the names of your text boxes to start
counting with zero and make an array of answers:

var correctInputs:Array=new Array("info0","info1","info2",...);

Then in your evaluate function you can do this:

var entryIsCorrect:Boolean=true;
for(var i=0;i<correctInputs.length;i++){
if(this["box"+i].text != correctInputs[i]){
trace("box"+i+" doesn't equal "+ correctInputs[i]);
entryIsCorrect=false;
}
}
if(entryIsCorrect){
trace("Correct entries all around")
} else {
trace("There was at least one error");
}

That way all you need to do if the number of boxes changes is to add a box to
the stage and add it's correct entry to your array. Snazzy, huh?


 
 
Rothrock





PostPosted: 2008-6-13 3:08:00 Top

java-programmer >> if and else statements PS: I forgot to mention that when you are done listening for the enter key you need to removeListener so that your evaluate function isn't called again if they press the enter key.
 
 
Mr.Wallace





PostPosted: 2008-6-13 4:02:00 Top

java-programmer >> if and else statements So, is this the way I should have tocode laid out?

I don't think I need the TRACE in there do I? I want users to be taken to
either the frame that is labelled CORRECT if theyare right and if they are
wrong, they get taken to the frame labelled INCORRECT.



Selection.setFocus(box1);

var listener:Object=new Object();
listener.onKeyDown=function(){
if (Key.isDown(Key.ENTER)){
evaluate();
}
}

function evaluate(){
if(box1.text=="info1" && box2.text=="info2" && so on){
trace ("correct");
} else {
trace("incorrect");
}
}

 
 
Gaz.T.





PostPosted: 2008-6-13 18:39:00 Top

java-programmer >> if and else statements You don't need the Trace commands, (that just prints 'correct' or 'incorrect'
to your output box, useful for debugging) you can replace them with
gotoAndStop("CORRECT"); and gotoAndStop("INCORRECT"); If you just want to jump
to those frame labels and stop.

I think, like rothrock says, you'll also need to add

Key.removeListener(listener);

to switch the listener off when after you've done your evaluation.




 
 
Mr.Wallace





PostPosted: 2008-6-13 22:47:00 Top

java-programmer >> if and else statements Man...this is killing me that I can't figure it out...it seems to be an easy
answer.

This code still isn't working for me for some reason. Tried a bunch of
different ways but still nothing. When I run the preview projector and fill in
the 4 boxes with either the right or wrong answers, nothing happens.

Here is the script I used:



Selection.setFocus(box1);

var listener:Object=new Object();
listener.onKeyDown=function(){
if (Key.isDown(Key.ENTER)){
evaluate();
}
}

function evaluate(){
if(box1.text=="info1" && box2.text=="info2" && so on){
gotoAndStop("Correct");
} else {
gotoAndStop("Incorrect");
}
}

Key.removeListener(listener);

 
 
Mr.Wallace





PostPosted: 2008-6-14 2:15:00 Top

java-programmer >> if and else statements Geez, I'm starting to think that I'm not going to be able to do this...
 
 
Rothrock





PostPosted: 2008-6-14 2:51:00 Top

java-programmer >> if and else statements Well add some traces to help you see the progress. (They won't work in the
projector, but should in the testing environment.)

And that "so on" part is to actually be filled out by you with the rest of the
conditionals. So if you haven't done that then do so.

So add those traces. Run it again and see if you can figure out what is
happening. If not, cut and paste the traces here.

var listener:Object = new Object();
listener.onKeyDown = function() {
trace("A key is down.");
if (Key.isDown(Key.ENTER)) {
trace("That time it was the enter key, so I should evaluate.");
evaluate();
}
};

function evaluate() {
trace("Yup, I'm evaluating.");
trace("box1 text is: "+box1.text);
trace("box1 should be: "+info1);
trace("box2 text is: "+box2.text);
trace("box2 should be: "+info2);
trace("box3 text is: "+box3.text);
trace("box3 should be: "+info3);
trace("box4 text is: "+box4.text);
trace("box4 should be: "+info4);
if (box1.text == "info1" && box2.text == "info2" && box3.text == "info3" &&
box4.text == "info4") {
trace("Conditions met. So it is correct.")
gotoAndStop("Correct");
} else {
trace("Conditions not met. So it is not correct.");
gotoAndStop("Incorrect");
}
}

 
 
Mr.Wallace





PostPosted: 2008-6-14 3:55:00 Top

java-programmer >> if and else statements ...damn...still nothing man. I didn't even get the Output Panel to pop up,
didn't read the traces at all. I created a new movie just to test the script
out and it doesn't work for me. I named the boxes accordingly in the 'Instance
Name' boxes; also tried to name them in the 'Variable' box; even tried putting
labels in both "Instance' and 'Variable' boxes, nothing worked. This is exactly
the script I used...almost exactly as you showed me Rock:





stop();

var listener:Object = new Object();
listener.onKeyDown = function() {
trace("A key is down.");
if (Key.isDown(Key.ENTER)) {
trace("That time it was the enter key, so I should evaluate.");
evaluate();
}
};

function evaluate() {
trace("Yup, I'm evaluating.");
trace("box1 text is: "+box1.text);
trace("box1 should be: "+info1);
trace("box2 text is: "+box2.text);
trace("box2 should be: "+info2);
trace("box3 text is: "+box3.text);
trace("box3 should be: "+info3);
trace("box4 text is: "+box4.text);
trace("box4 should be: "+info4);
if (box1.text == "info1" && box2.text == "info2" && box3.text == "info3" &&
box4.text == "info4") {
trace("Conditions met. So it is correct.")
gotoAndStop("Correct");
} else {
trace("Conditions not met. So it is not correct.");
gotoAndStop("Incorrect");
}
}

 
 
Rothrock





PostPosted: 2008-6-14 4:38:00 Top

java-programmer >> if and else statements Did you add the listener?

Key.addListener(listener)

You won't be listening for any keys if you don't do that!

And don't use the variable box. That just messes everything up.