# Simple problem - referencing objects by variable name

**URL:** <https://forum.kirupa.com/t/simple-problem-referencing-objects-by-variable-name/212514>\
**Category:** flash\
**Created:** [January 11, 2007, 5:37pm UTC](https://forum.kirupa.com/t/simple-problem-referencing-objects-by-variable-name/212514 "2007-01-11T17:37:35Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Transition](https://avatars.discourse-cdn.com/v4/letter/t/ebca7d/32.png) [@Transition](https://forum.kirupa.com/u/Transition)\
**Post date:** [January 11, 2007, 5:37pm UTC](https://forum.kirupa.com/t/simple-problem-referencing-objects-by-variable-name/212514/1 "2007-01-11T17:37:35Z")

</div>

I have a simple function that dynamically creates text fields. My text field name is referenced by var thisTextField. Problem is, when i try to do things with my text field, actionscript shoots back an error as such:

\*\*There is no property with the name ‘text’.

\*\*How am i supposed to apply properties to my object if my objects name is a variable?

```auto
function showProducts() {
    
    var products:Number = 0;
    var thisTextField:String = "product" + products + "_txt";
    
    for (var itemID in _global.rtsData[_global.rtsPos]["products"]) {
    
        this.createTextField(thisTextField,1,25,75,350,50);
        trace(thisTextField);
        thisTextField.autoSize = true;
        product+products+_txt.text = _global.rtsData[_global.rtsPos]["products"][itemID]["products_name"];

        products++;
            
    }    
    
    _root.products_mc.gotoAndPlay("fadeIn");
       
}

```
