使用AS脚本修改TextArea内容,并监听TextArea内容变化事件

 

软件编程牛人

TextArea change事件,当用数据绑定,或使用AS语言改变TextArea内容时,此事件不发生

 

如需监听TextArea内容改变,可改用监听textChanged事件

 

package com.duoduo.lastday.view.ui.chat
{
	import flash.events.*;

	import mx.controls.TextArea;

	public class ChatMess extends TextArea
	{
		public function ChatMess()
		{
			super();
			this.verticalScrollPolicy="off";
			this.addEventListener("textChanged", changeHeight);
			this.setStyle("borderStyle", "none");
		}

		private function changeHeight(event:Event):void
		{
			trace("text改变");
			trace("abc");
			this.height=this.textHeight;
			trace("th:" + this.textHeight);
			this.validateNow();
			trace("h:" + this.height);
		}
	}
}

 

你可能感兴趣的:(编程,UI,脚本,Flash)