# Adding vars to textfield

**URL:** <https://forum.kirupa.com/t/adding-vars-to-textfield/295132>\
**Category:** Uncategorized\
**Created:** [August 25, 2009, 6:56pm UTC](https://forum.kirupa.com/t/adding-vars-to-textfield/295132 "2009-08-25T18:56:34Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jeancnicolas](https://avatars.discourse-cdn.com/v4/letter/j/7bcc69/32.png) [@jeancnicolas](https://forum.kirupa.com/u/jeancnicolas)\
**Post date:** [August 25, 2009, 6:56pm UTC](https://forum.kirupa.com/t/adding-vars-to-textfield/295132/1 "2009-08-25T18:56:34Z")

</div>

hey just simple code firing different functions upon onClick… how do I add my variables to a my error\_txt dynamic text field, without having to write tons of code?! im from as2, and before I would just::: my\_txt.text = myVar;  
here’s my code::

```auto
var num:uint = 0;
var nextFunction:Array = new Array(first,second,third);
stage.addEventListener(MouseEvent.CLICK, Advance);
function Advance(e:MouseEvent):void
{
    if (num != nextFunction.length)
    {
        nextFunction[num]();
        num ++;
    }
    else
    {
        error_txt.text = "end of functions";
    }
}
function first():void
{
    error_txt.textField += num;
}
function second():void
{
    error_txt = num;
}
function third():void
{
    error_txt += num;
}

```

and hmm doesnt display my current num var.  
Help!??? thanks
