# Extending the textfield

**URL:** <https://forum.kirupa.com/t/extending-the-textfield/284522>\
**Category:** flash\
**Created:** [March 19, 2009, 9:56pm UTC](https://forum.kirupa.com/t/extending-the-textfield/284522 "2009-03-19T21:56:46Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alber\_Kidd](https://avatars.discourse-cdn.com/v4/letter/a/e47c2d/32.png) [@Alber\_Kidd](https://forum.kirupa.com/u/Alber_Kidd)\
**Post date:** [March 19, 2009, 9:56pm UTC](https://forum.kirupa.com/t/extending-the-textfield/284522/1 "2009-03-19T21:56:46Z")

</div>

I am extending the Textfield and and formatting with a font I have in the library (swissHeavy). This is fine when I do it in the main timeline but not in my package. I have tried to import it but all that appears is the border and no text. Can someone help?

package{

```
import flash.text.TextField;
import flash.text.TextFieldAutoSize;
import flash.text.TextFormat;
import flash.text.AntiAliasType;
import swissHeavy;

public class MyTextField extends TextField
    {
        //private var final:uint = 100;
        var style1:TextFormat = new TextFormat(new swissHeavy().fontName, 20, 0xffffff );
        var style2:TextFormat = new TextFormat(new swissHeavy().fontName, 12, 0xffffff );
    
    
    
    public function MyTextField(myName, myMessage){
        
        trace(myName);
    
    super();
    this.embedFonts = true;
    this.text = "hello";
    this.border = true;
    this.defaultTextFormat = style1;
    this.x = 200;
    this.y = 200;
    }

```

}}
