-
running function
Hey guys
How do i get function to run again and again. I have this thing where i want to check 5 textfields if they have any text in them.
I made a function
PHP Code:
function test(){
if(q_txt.text == "" && a1_txt.text == "" && a2_txt.text == "" && a3_txt.text == "" && a4_txt.text == "" )
{
compile_btn.visible = true;
compile = true;
}
else
{
compile_btn.visible = false;
compile = false;
}
}
test();
but this function only runs once and once it's run if i type in any thing in the text field it doesn't do anything.
How do i get it to check again and again
-
newb of many sorts
do something like this...
just add a change event to each of your textfields. That way whenever the text changes, the function will run...
q_txt.addEventListener(Event.CHANGE, test);
a1_txt.addEventListener(Event.CHANGE, test);
a2_txt.addEventListener(Event.CHANGE, test);
a3_txt.addEventListener(Event.CHANGE, test);
a4_txt.addEventListener(Event.CHANGE, test);
make sure to adjust your function to be used as a listener...
PHP Code:
function test([B]e:Event[/B]):void { if(q_txt.text == "" && a1_txt.text == "" && a2_txt.text == "" && a3_txt.text == "" && a4_txt.text == "" ) { compile_btn.visible = true; compile = true; } else { compile_btn.visible = false; compile = false; } } }
Search first, asked questions later.
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
|