# Instance variable TextField + createTextField()

**URL:** <https://forum.kirupa.com/t/instance-variable-textfield-createtextfield/244755>\
**Category:** flash\
**Created:** [November 21, 2007, 2:23pm UTC](https://forum.kirupa.com/t/instance-variable-textfield-createtextfield/244755 "2007-11-21T14:23:11Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![grandpaw\_broon](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/grandpaw_broon/32/3985_2.png) [@grandpaw\_broon](https://forum.kirupa.com/u/grandpaw_broon)\
**Post date:** [November 21, 2007, 2:23pm UTC](https://forum.kirupa.com/t/instance-variable-textfield-createtextfield/244755/1 "2007-11-21T14:23:11Z")

</div>

Hi all,

I am having a bit of a headache with regards to this problem

```auto
 
class A {
 
     private var tf:TextField;
     private var canvas:MovieClip
 
     public function A (target_mc:MovieClip)
     {
          this.canvas = target_mc;
          this.tf = canvas.createTextField("tf");
     }
 
}

```

Forgive the syntax as i dont have access to flash ATM.

Why is it that the above code does not work? I need reference to the textfield so i can apply different TextFormats depending on the state of target\_mc.

Why does flash complain that Void is found where textField is expected?

Thanks 😃
