# Adding TextField using AS3

**URL:** <https://forum.kirupa.com/t/adding-textfield-using-as3/319263>\
**Category:** flash\
**Created:** [February 14, 2011, 4:44pm UTC](https://forum.kirupa.com/t/adding-textfield-using-as3/319263 "2011-02-14T16:44:23Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![shtrudel](https://avatars.discourse-cdn.com/v4/letter/s/ccd318/32.png) [@shtrudel](https://forum.kirupa.com/u/shtrudel)\
**Post date:** [February 14, 2011, 4:44pm UTC](https://forum.kirupa.com/t/adding-textfield-using-as3/319263/1 "2011-02-14T16:44:23Z")

</div>

Hi there,

I am very very new to Flash programming and I am trying to add a TextField using AS3. I found the following code on the net and pasted it in a new project but it does not work for me, Ⓜ

var myTextField:TextField = new TextField();  
myTextField.text = “Hello, world!”  
myTextField.x = 10;  
myTextField.y = 10;

var myTextFormat = new TextFormat();  
myTextFormat.font=“Arial”;  
myTextFormat.size=12;

myTextField.defaultTextFormat = myTextFormat;  
addChild(myTextField);

any Idea why it does not work ?

Regards,
