Is it possible to test value of dynamic text field

I want to be able to do an if/else statement to test the value of a dynamic text field. The value will always be either yes or no. So, for instance,

 if textfield.value = "yes" then
 do something
else if textfield value = "no" then
 do something different
end if

Is that something that is possible? What would the syntax be? The dynamic text field is being populated from an external text file.

if (textfield.text == "yes") {
 //then do something
} else if (textfield.text == "no") {
 //then do something different
}

aww man, an actionscript question i can finally answer and you beat me to it!
I’ll get there next time!:pir:

btw, you have to give your dynamic textbox an instance name, here’s an example for one named yesOrNo.

if(yesOrNo.text == “yes”){
trace(“The box says yes!”);
}
else if(yesOrNo.text == “no”){
trace(“The box says no!”);
}

… how do you enter actionscript code into kirupaforum?

Ya, but you have a picture :thumb:

AS tags are [noparse]


[/noparse]

hey, canadian, i have an idea! Can you answer MY question I had two days ago? Here! http://www.kirupa.com/forum/showthread.php?t=213102
Cool, i’ll ActionScript Code:
[FONT=Courier New][LEFT]have to [COLOR=#0000FF]try[/COLOR] [COLOR=#0000FF]this[/COLOR].[COLOR=#000080]another[/COLOR] [COLOR=#0000FF]time[/COLOR]!
[/LEFT]
[/FONT]

we sure do edit our posts a lot! … aw man the forums caught my edit!

lol… the “else if” is not necessary, for it only has two values, you can use just plain “else” like Canadian said. But since were spamming this guy with answers:

 textfield.text == "yes" ? /*then do something if yes*/ : /*then do something if no*/

What if the value is something other than yes or no?

The value will always be either yes or no.

Dont’cha know?:slight_smile:

[SIZE=1][COLOR=silver]shutup:worried::pa::ne:[/COLOR][/SIZE]

:slight_smile: