# Need help regarding adding Textfield to Flash document

**URL:** <https://forum.kirupa.com/t/need-help-regarding-adding-textfield-to-flash-document/264719>\
**Category:** flash\
**Created:** [June 29, 2008, 1:15pm UTC](https://forum.kirupa.com/t/need-help-regarding-adding-textfield-to-flash-document/264719 "2008-06-29T13:15:57Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![balajee](https://avatars.discourse-cdn.com/v4/letter/b/ed655f/32.png) [@balajee](https://forum.kirupa.com/u/balajee)\
**Post date:** [June 29, 2008, 1:15pm UTC](https://forum.kirupa.com/t/need-help-regarding-adding-textfield-to-flash-document/264719/1 "2008-06-29T13:15:57Z")

</div>

:sen:

---

<div class="post-metadata">

**Author:** ![glosrfc](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/glosrfc/32/8334_2.png) [@glosrfc](https://forum.kirupa.com/u/glosrfc)\
**Post date:** [June 29, 2008, 1:33pm UTC](https://forum.kirupa.com/t/need-help-regarding-adding-textfield-to-flash-document/264719/2 "2008-06-29T13:33:26Z")

</div>

Ummmm…here you go:  
[http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/text/TextField.html](http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/text/TextField.html)

You’re far more likely to get help if you provide specific details of what your problem is.

---

<div class="post-metadata">

**Author:** ![abrarshf](https://avatars.discourse-cdn.com/v4/letter/a/a698b9/32.png) [@abrarshf](https://forum.kirupa.com/u/abrarshf)\
**Post date:** [June 29, 2008, 1:54pm UTC](https://forum.kirupa.com/t/need-help-regarding-adding-textfield-to-flash-document/264719/3 "2008-06-29T13:54:54Z")

</div>

dear which type of text field u want to put in flash doc.

---

<div class="post-metadata">

**Author:** ![balajee](https://avatars.discourse-cdn.com/v4/letter/b/ed655f/32.png) [@balajee](https://forum.kirupa.com/u/balajee)\
**Post date:** [June 29, 2008, 7:21pm UTC](https://forum.kirupa.com/t/need-help-regarding-adding-textfield-to-flash-document/264719/4 "2008-06-29T19:21:14Z")

</div>

my friend abrarshf it is dynamic text field

---

<div class="post-metadata">

**Author:** ![sekasi](https://avatars.discourse-cdn.com/v4/letter/s/5f8ce5/32.png) [@sekasi](https://forum.kirupa.com/u/sekasi)\
**Post date:** [June 29, 2008, 7:43pm UTC](https://forum.kirupa.com/t/need-help-regarding-adding-textfield-to-flash-document/264719/5 "2008-06-29T19:43:39Z")

</div>

Read. The. Link. : )

---

<div class="post-metadata">

**Author:** ![balajee](https://avatars.discourse-cdn.com/v4/letter/b/ed655f/32.png) [@balajee](https://forum.kirupa.com/u/balajee)\
**Post date:** [June 30, 2008, 1:29pm UTC](https://forum.kirupa.com/t/need-help-regarding-adding-textfield-to-flash-document/264719/6 "2008-06-30T13:29:24Z")

</div>

Hi glosrfc

please find the RunningTest.as code below and it’s working fine on document class but my problem is i want to reuse the code in flash action panel with new values to instance variables and i expected output according to that. and i am expecting like this please help me to find the solution.

# var txt:RunningText = new RunningText(); txt.fName= “Times New Roman”; txt.tMatter1 = “Some custom Text falls here”; addChild(txt);

# [SIZE=“5”]The error is [/SIZE]

* * *

TypeError: Error #1009: Cannot access a property or method of a null object reference.  
at RunningText$iinit()  
at RunningText\_fla::MainTimeline/RunningTextRevised\_fla::frame1()

* * *

package {

```
import flash.display.*;
import flash.text.*;
import flash.events.*;

public class RunningText extends Sprite {
	
	public var tField1:TextField = new TextField();
	public var tField2:TextField = new TextField();
	public var tFormat1:TextFormat;
	public var tFormat2:TextFormat;
	public var fName:String = "Arial";
	public var fColor:uint = 0xCC00CC;
	public var fSize:int = 20;
	public var tMatter1:String = "There is no topic available. Use the Search or Table of Contents to locate the desired information.Use the Search or Table of Contents ";
	public var tMatter2:String = "The String class is a data type that represents a string of characters. The String class provides methods and properties. ";
	public var valueX:int = stage.stageWidth / 2;
	public var valueY:int = stage.stageHeight / 2;
	public var speed:int = 10;
	public var endX:int = -1;
	public var distX:int = 5;
	
	
	public function RunningText(){
		
		tFormat1 = new TextFormat(fName,fSize,fColor);
		
		tField1.multiline = false;
		tField1.autoSize = TextFieldAutoSize.LEFT;
		tField1.defaultTextFormat = tFormat1;
		tField1.text = tMatter1;			
		addChild(tField1);
		tField1.x = valueX;
		tField1.y = valueY;
		
		tField2.multiline = false;
		tField2.autoSize = TextFieldAutoSize.LEFT;
		tField2.defaultTextFormat = tFormat1;
		tField2.text = tMatter2;
		addChild(tField2);
		tField2.x = valueX + tField1.width + 2 ;
		tField2.y = valueY;
		
		addEventListener(Event.ENTER_FRAME,eFrame);		
	}
	
	function eFrame(e:Event){
		
		tField1.x -= speed;
		tField2.x -= speed;
		
		var bound1 = tField1.getBounds(root);
		var bound2 = tField2.getBounds(root);
		
		if (bound1.right &lt;= endX) {
			tField1.x = bound2.right + distX;
		}
		
		if (bound2.right &lt;= endX) {
			tField2.x = bound1.right + distX;
		}
		

	}
   }

```

}
