Need help regarding adding Textfield to Flash document

:sen:

Ummmm…here you go:
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.

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

my friend abrarshf it is dynamic text field

Read. The. Link. : )

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 <= endX) {
			tField1.x = bound2.right + distX;
		}
		
		if (bound2.right <= endX) {
			tField2.x = bound1.right + distX;
		}
		

	}
   }

}