# Displaying Text

**URL:** <https://forum.kirupa.com/t/displaying-text/260089>\
**Category:** flash\
**Created:** [May 12, 2008, 3:00pm UTC](https://forum.kirupa.com/t/displaying-text/260089 "2008-05-12T15:00:31Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![vivaretro](https://avatars.discourse-cdn.com/v4/letter/v/a3d4f5/32.png) [@vivaretro](https://forum.kirupa.com/u/vivaretro)\
**Post date:** [May 12, 2008, 3:00pm UTC](https://forum.kirupa.com/t/displaying-text/260089/1 "2008-05-12T15:00:31Z")

</div>

Hi, I swear I’ve gotten this to work when I just did it on the main timeline  
but as part of a package I can’t seem to get my text to appear…

package  
{

```
import flash.text.*;
import flash.display.*;
import fl.transitions.Tween;
import fl.transitions.TweenEvent;
import fl.transitions.easing.*;

public class fontMaker extends MovieClip
{
    var beloDin:Font = new Belo(); 
    
    var myFormat:TextFormat = new TextFormat();
    var countyTextFieldBelo:TextField = new TextField();
    var countyFormat:TextFormat = new TextFormat();
    var test:String = "test";
    
    public function fontMaker()
    {
        
        trace("fontmaker is run");
        
        countyFormat.font = beloDin.fontName;
        countyFormat.size = 600;
        countyFormat.color = 0x000000;
        countyTextFieldBelo.autoSize = TextFieldAutoSize.LEFT;
        countyTextFieldBelo.defaultTextFormat = countyFormat;
        countyTextFieldBelo.embedFonts = true;
        countyTextFieldBelo.alpha = 1;
        countyTextFieldBelo.text = test;
        countyTextFieldBelo.x = 300;
        countyTextFieldBelo.y = 400;
        countyTextFieldBelo.selectable = false;
        countyTextFieldBelo.width = 1920;
        countyTextFieldBelo.height = 1080;
        
        keyFont();
        
    }
    
    public function keyFont()
    {
        
        trace ("keyFont has run");
        
        addChild(countyTextFieldBelo);
                                
    }    
}

```

}

---

<div class="post-metadata">

**Author:** ![vivaretro](https://avatars.discourse-cdn.com/v4/letter/v/a3d4f5/32.png) [@vivaretro](https://forum.kirupa.com/u/vivaretro)\
**Post date:** [May 12, 2008, 3:27pm UTC](https://forum.kirupa.com/t/displaying-text/260089/2 "2008-05-12T15:27:13Z")

</div>

> [@ahmednuaman;2325079](#):
>
> try stage.addChild(countyTextFieldBelo);

I added that and now get this error:

1120: Access of undefined property countyTextFieldBelo.

---

<div class="post-metadata">

**Author:** ![vivaretro](https://avatars.discourse-cdn.com/v4/letter/v/a3d4f5/32.png) [@vivaretro](https://forum.kirupa.com/u/vivaretro)\
**Post date:** [May 12, 2008, 3:34pm UTC](https://forum.kirupa.com/t/displaying-text/260089/3 "2008-05-12T15:34:28Z")

</div>

> [@ahmednuaman;2325084](#):
>
> try: public var countyTextFieldBelo:TextField = new TextField();

I still get the same error.

---

<div class="post-metadata">

**Author:** ![vivaretro](https://avatars.discourse-cdn.com/v4/letter/v/a3d4f5/32.png) [@vivaretro](https://forum.kirupa.com/u/vivaretro)\
**Post date:** [May 12, 2008, 3:48pm UTC](https://forum.kirupa.com/t/displaying-text/260089/4 "2008-05-12T15:48:43Z")

</div>

[quote=ahmednuaman;2325088]Instead of: countyTextFieldBelo.defaultTextFormat = countyFormat;  
Try: countyTextFieldBelo.setTextFormat(countyFormat);

Read up on this: [http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/text/TextField.html](http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/text/TextField.html)

(Because the error is: 1120: Access of undefined property countyTextFieldBelo. It’s saying that it can’t find one of the specified properties as being part of the TextField format)[/quote]

Thanks!

---

<div class="post-metadata">

**Author:** ![vivaretro](https://avatars.discourse-cdn.com/v4/letter/v/a3d4f5/32.png) [@vivaretro](https://forum.kirupa.com/u/vivaretro)\
**Post date:** [May 12, 2008, 4:41pm UTC](https://forum.kirupa.com/t/displaying-text/260089/5 "2008-05-12T16:41:32Z")

</div>

> [@ahmednuaman;2325094](#):
>
> So it work yea?

not yet. I changed  
public class fontMaker extends MovieClip  
to  
public class fontmaker extends Sprite  
then put  
var Floader:Sprite = new fontMaker;  
in my main Document class  
that got rid of the error but still no font visible on the stage.

---

<div class="post-metadata">

**Author:** ![vivaretro](https://avatars.discourse-cdn.com/v4/letter/v/a3d4f5/32.png) [@vivaretro](https://forum.kirupa.com/u/vivaretro)\
**Post date:** [May 12, 2008, 6:26pm UTC](https://forum.kirupa.com/t/displaying-text/260089/6 "2008-05-12T18:26:48Z")

</div>

I noticed fontMaker was changed to FontMaker at:

var fontMaker = new FontMaker();

is that right?

I get this error:  
1180: Call to a possibly undefined method FontMaker.

if I make it var fontMaker = new fontmaker();  
I get this error:  
TypeError: Error #1007: Instantiation attempted on a non-constructor.  
at Document()

plus how do I change keyFont to return TextField?
