# Prototype function returning Boolean

**URL:** https://forum.kirupa.com/t/prototype-function-returning-boolean/189912
**Category:** flash
**Created:** [June 7, 2006, 4:55am UTC](https://forum.kirupa.com/t/prototype-function-returning-boolean/189912 "2006-06-07T04:55:41Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![B\_L\_U\_E](https://avatars.discourse-cdn.com/v4/letter/b/ba8739/32.png) [@B\_L\_U\_E](https://forum.kirupa.com/u/B_L_U_E)
#### Post date: [June 7, 2006, 4:55am UTC](https://forum.kirupa.com/t/prototype-function-returning-boolean/189912/1 "2006-06-07T04:55:41Z")

</div>

I have the following test code:  
[AS]\_root.txtIn = function(str:String, txt:TextField):Boolean {  
try {  
var len = str.length;  
var index:Number = new Number(0);  
func = function () {  
if (index\>=len) {  
clearInterval(si);  
return true;  
}  
index++;  
};  
si = setInterval(func, 20);  
} catch (myError) {  
txt.text = myError;  
return false;  
}  
};[/AS]As you can see, it runs through several intervals before it actually returns a value. How would I go about evaluating it, if it always returns undefined before the interval ends? For example [AS]if(\_root.txtIn(txtm, txtmain)) {  
trace(true);  
}  
trace(\_root.txtIn(txtm, txtmain));[/AS]2nd trace returns undefined. Any ideas?
