# Basic: Display text from class

**URL:** <https://forum.kirupa.com/t/basic-display-text-from-class/286096>\
**Category:** flash\
**Created:** [April 9, 2009, 9:52pm UTC](https://forum.kirupa.com/t/basic-display-text-from-class/286096 "2009-04-09T21:52:35Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ryrocks](https://avatars.discourse-cdn.com/v4/letter/r/ba9def/32.png) [@ryrocks](https://forum.kirupa.com/u/ryrocks)\
**Post date:** [April 9, 2009, 9:52pm UTC](https://forum.kirupa.com/t/basic-display-text-from-class/286096/1 "2009-04-09T21:52:35Z")

</div>

Hey,

I’m dynamically loading a movieclip onto the stage.

```auto

...
private var _endGame:The_end = new The_end();
...
_endGame = new The_end();
stage.addChild(_endGame);

```

In this movieclip I have a dynamic text field named ‘game\_score\_txt’

In the class for this movieclip; The\_end.as I want to display some text.

I figured the following code would work:

```auto

package
{
	import flash.display.MovieClip;
	import flash.events.*;
	
	public class The_End extends MovieClip
	{		
		public function The_End()
		{
			stage.addEventListener(Event.ENTER_FRAME, display_text);
		}
		public function display_text(event:Event)
		{
			game_score_txt.text = String("hello world");
		}
	}
}

```

But I get the following error:

1046: Type was not found or was not a compile-time constant: TextField.

Any help would be much appreciated.
