# Function, return problem

**URL:** <https://forum.kirupa.com/t/function-return-problem/206294>\
**Category:** Uncategorized\
**Created:** [November 6, 2006, 10:44pm UTC](https://forum.kirupa.com/t/function-return-problem/206294 "2006-11-06T22:44:07Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Esseti](https://avatars.discourse-cdn.com/v4/letter/e/bb73d2/32.png) [@Esseti](https://forum.kirupa.com/u/Esseti)\
**Post date:** [November 6, 2006, 10:44pm UTC](https://forum.kirupa.com/t/function-return-problem/206294/1 "2006-11-06T22:44:07Z")

</div>

Hi,

I think its a matter of function scope, but I can’t get my head around it. I’m simply loading an external file with a variable that I want to pass from the loadVars function. It goes something like this.

count.txt - file  
nr - the name of the loaded variable that is in the file  
working - a dynamic textfield for the working number  
notworking - a dynamic textfield in which I get “undefined”

```auto

loadVarsNum = new LoadVars();
loadVarsNum.onLoad = function(success) {
	if (success) {
		trace("loaded");
		_root.working.text = this.nr;
	} else {
		trace("not loaded");
	}
};
loadVarsNum.load("count.txt");

_root.notworking.text = nr;

```

Is it because I need to add “…cess):Number’” and in the function “return nr;” ? Or is it because I don’t have the “nr” variable when I assign it to the second textfield?

Thank you.
