# Function problem

**URL:** <https://forum.kirupa.com/t/function-problem/148713>\
**Category:** Uncategorized\
**Created:** [May 22, 2005, 10:13pm UTC](https://forum.kirupa.com/t/function-problem/148713 "2005-05-22T22:13:17Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Knorcedger](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/knorcedger/32/1244_2.png) [@Knorcedger](https://forum.kirupa.com/u/Knorcedger)\
**Post date:** [May 22, 2005, 10:13pm UTC](https://forum.kirupa.com/t/function-problem/148713/1 "2005-05-22T22:13:17Z")

</div>

I have created an swf which has a button, and a dynamic text box (i used it instead of trace)

The button has this code

```php
on (press) { 
    data = new LoadVars(); 
    data.onLoad = function(ok) { 
 	  if (ok) { 
 		 _root.fire = data.name; 
 	  } 
    }; 
    data.load("test.txt"); 
    pass = _root.fire; 
 } 

```

and “pass” is the name of the text box. The problem is that the above code gives “undefined”. If i put “pass = \_root.fire;” inside the function it will work, but i want \_root.fire to use it in other functions as well.

I f u want, take a look at the fla

[fla here](http://www.dreamquest.gr/experiments/hittest%20test/test.fla)
