Forum Moderators: open

Message Too Old, No Replies

"IF" Statement Error

         

inveni0

2:00 am on Dec 30, 2005 (gmt 0)

10+ Year Member



I have a Dynamic Text Box that loads text from an outside text file. I want to write actionscript code that will make a button (_root.mainbutton._visible) invisible if the text box contains the word "disable". When I use my if statement:

if (_root.textbox.text == "disable") {
_root.mainbutton._visible = false;
}

It does nothing.

Any help?

Richard_N

8:35 am on Dec 30, 2005 (gmt 0)



Try setting a variable within a button function.

buttondisable_btn.onPress = function(){
myVariable = textbox.text;
if (myVariable == "disable") {
mainbutton._visible = false;
}
}

Put this on the root timeline. You really should let an imput text box have a button to execute it, otherwise set up a listener to dynamically check for changes to the text box.

inveni0

3:36 pm on Dec 30, 2005 (gmt 0)

10+ Year Member



The text box has text from an external file onLoad, so I placed the code in an onLoad/success script and it worked.

Thanks!