Groups | Blog | Home
all groups > flash actionscript > february 2004 >

flash actionscript : If Else if Problems


poopyman67
2/10/2004 11:42:09 PM
I'm making a e-mailer form on my web page, and I got a combobox that has as
choices all of the states. What I want it to do is that when a user picks a
state, it sends the e-mailto the appropriate person(denoted by names west,
east, etc.
heres the code i have so far. I get 2 errors. 1st says im missing a (
somewhere in the first statement, 2nd says the if at the end of the else if
statement(last one) doesn't match. ANy help would be greatly appreciated


Jack.
2/10/2004 11:57:22 PM
this should fix the on(event) errors

on(release)
if(STATE.text == "CA,OR,WA,ID,NV,MT,WY,UT,AZ,AK,HI,NM")
recipient = "WEST"
}else if(STATE.text == "TX,CO,ND,SD,NE,KS,OK,AR,IA,MO")
recipient = "SOUTH"
}else if(STATE.text == "MN,LA,WI,IL,KV,AL,GA,MS,FL,SC,NC,VA,WV,IN,MI")
recipient = "EAST"
} else
recipient = "North"

getURL("")



poopyman67
2/11/2004 12:29:47 AM
Jack,
I can't thank you enough man!!! YOu saved my butt on that one!

Jack.
2/11/2004 12:32:32 AM
no pb :)
Good Luck
iamalex
2/16/2004 4:16:02 AM
I see you helped someone else with recipient. Can you please help me with an
array. When numbers selected, to go to a particular frame? and if not
selected for message to display????
appreciate greatly. ale


on(release)
if(STATE.text == "1,2,3")
gotoAndStop (21)
}else if(STATE.text == "4,5,6")
gotoAndStop (22)
} else
messge = "Please select a State"



pazzoboy
2/16/2004 12:34:54 PM
If you want something to happen if STATE.text is an element of an array, try something like:
for(x=0;x<arrayName.length;x++){
if(STATE.text ==arrayName[x]){
do something;
}
iamalex
2/16/2004 3:07:15 PM
I will try that.
Thank you very much.
Jeckyl
2/16/2004 3:31:20 PM
[quoted text, click to view]

Are you actually expecting the user to type in "1,2,3" ?? Because that is
what you are testing for.

Or are you waning to check for one of three possibilities.. in which case
use

if (STATE.text = "1" || STATE.text = "2" || STATE.text = "3")

etc

AddThis Social Bookmark Button