# Convert the value of a variable into the name of a variable. sight!

**URL:** <https://forum.kirupa.com/t/convert-the-value-of-a-variable-into-the-name-of-a-variable-sight/285816>\
**Category:** Uncategorized\
**Created:** [April 6, 2009, 11:10pm UTC](https://forum.kirupa.com/t/convert-the-value-of-a-variable-into-the-name-of-a-variable-sight/285816 "2009-04-06T23:10:57Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![evac12](https://avatars.discourse-cdn.com/v4/letter/e/7cd45c/32.png) [@evac12](https://forum.kirupa.com/u/evac12)\
**Post date:** [April 6, 2009, 11:10pm UTC](https://forum.kirupa.com/t/convert-the-value-of-a-variable-into-the-name-of-a-variable-sight/285816/1 "2009-04-06T23:10:57Z")

</div>

Hi everyone, this is my predicament:

- I have loaded a TXT file in my flash file (MyTextFile.txt).
- In the TXT file there are a bunch of variables (Name1, Name2, etc…) each representing the name of a person.
- Now, I have a dinamic text field (var:\_root.MyName) where a name of a person is going to appear.
- For that I have a lot of buttons (one for each person in the TXT file)
- So I have this “brilliant” idea
- I gave to every button an instance name identical as the name of the variable it needs to access in the TXT file. Ej. If I click on button (instance name: Name1), the dynamic text field should showr the name of the person stored in the variable Name1 loaded from the TXT file.
- For that I wrote this code in the Button:

on (release){  
var newName = this.\_name  
\_root.TheName = newName;  
}

- And in frame one used this code:

varnombre = \_root.TheName;  
var lv:LoadVars = new LoadVars();  
lv.onLoad = function(obj) {  
MyName = varnombre;  
}  
lv.load(“MyTextFile.txt”);

- The problem is: Instead of appearing the name of the person in the dynamic text field (var:MyName) what appears is the name of the variable: ej. Name1.

Can someone help me? thank you very muchin advance
