# Adding/Accessing Global-TextField in a Class

**URL:** <https://forum.kirupa.com/t/adding-accessing-global-textfield-in-a-class/275518>\
**Category:** flash\
**Created:** [November 14, 2008, 10:05pm UTC](https://forum.kirupa.com/t/adding-accessing-global-textfield-in-a-class/275518 "2008-11-14T22:05:30Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![energy](https://avatars.discourse-cdn.com/v4/letter/e/f1d935/32.png) [@energy](https://forum.kirupa.com/u/energy)\
**Post date:** [November 14, 2008, 10:05pm UTC](https://forum.kirupa.com/t/adding-accessing-global-textfield-in-a-class/275518/1 "2008-11-14T22:05:30Z")

</div>

Hi Everybody,

I generally work with AS3 classes but havn’t tried class stuff in AS2 much. Now i need to work this out due to some AS2 project.  
I am trying to create a dynamic TextField in a Class and i want to add it on the stage and access it from all functions as well.  
What i am tying is this:

[AS]class ABC extends TextField  
{

```
		public static var loaded_txt:TextField; = new TextField();

		function ABC()
		{

		}
		

		function test()
		{
			loaded_txt.text = "Some Text";	
		}

```

}[/AS]

I need loaded\_txt to be added on the tage. I can’t use “createTextField” as that can be done only inside a function and then it will become local but i need it global. How can that be done.Any ideas please?

Thanks!
