# Textfield variable name

**URL:** <https://forum.kirupa.com/t/textfield-variable-name/300667>\
**Category:** Uncategorized\
**Created:** [November 25, 2009, 10:48am UTC](https://forum.kirupa.com/t/textfield-variable-name/300667 "2009-11-25T10:48:49Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Urme](https://avatars.discourse-cdn.com/v4/letter/u/f1d935/32.png) [@Urme](https://forum.kirupa.com/u/Urme)\
**Post date:** [November 25, 2009, 10:48am UTC](https://forum.kirupa.com/t/textfield-variable-name/300667/1 "2009-11-25T10:48:49Z")

</div>

I have 3 textfields, and an eventlistener for each textfield which looks like this:

```php

var currentSelectedTextfield:String = "textfield1";
mc1.mc2.textfield1.addEventListener(FocusEvent.FOCUS_IN, handleFocusIn);
mc1.mc2.textfield2.addEventListener(FocusEvent.FOCUS_IN, handleFocusIn);
mc1.mc2.textfield3.addEventListener(FocusEvent.FOCUS_IN, handleFocusIn);

function handleFocusIn(e:Event) {
    currentSelectedTextfield = e.currentTarget.name;
}

```

The thing I want to do is using “currentSelectedTextfield” variable in another function like this:

```php

function addLetter(myWord:String):Function {
    return function():void {
        switch(myWord) {
            default:
                myWord = myWord;
                break;
        }
        mc1.mc2.currentSelectedTextfield.appendText(myWord);
        
}

```

But this obviously isn’t working, any ideas? 🙂
