-
Input text box
Hi guys,
Here i am using one input text box and one button. In the beginning the button should be invisible. Once i started to type text in input text box, the button should be visible. How to do....
I used following script. But it's not working. pls help me guys..
stage.addEventListener(Event.ENTER_FRAME, enter_but_fun);
function enter_but_fun(Event) {
if (user_name.text==" ") {
enter_but.visible==false;
} else {
enter_but.visible==true;
}
}
-
Senior Member
user_name.addEventListener(Event.CHANGE, enter_but_fun);
function enter_but_fun(e:Event) {
var myInput:TextInput = e.currentTarget as TextInput;
if (myInput.text==" ") {
enter_but.visible=false;
} else {
enter_but.visible=true;
}
}
- The right of the People to create Flash movies shall not be infringed. -
-
Senior Member
A couple of things to make it work, first and most obvious is the "==" within the function. Those are only needed for conditional statements not for setting values to objects/variables. Next would be, to replace the "text" property with a textfields "length", so it would look something like this.
Actionscript Code:
function enter_but_fun(e:Event):void { if(user_name.length == 1) { enter_but.visible = false; } else { enter_but.visible = true; } }
Wile E. Coyote - "Clear as mud?"
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
|