我做了一个简单的聊天应用程序,但我遇到了这个问题,文本区域会填满,然后用户必须清除它。我怎样才能做到,如果文本区域达到一定数量的字符,它将清除旧聊天文本 ?
public function receiveMsg(userName:String,type:String,msg:String,txtColor:String):void{
if(type == "user"){
ConsoleTxt.htmlText += "<b>"+userName+"</b>: <font color='"+txtColor+"'>"+msg+"</font> \n"
}
if(type == "server"){
ConsoleTxt.htmlText += "<b><font color='#6ade57'>SERVER</font></b> "+userName+" "+msg+"\n"
}
if(type == "disconnect"){
ConsoleTxt.htmlText += "<b><font color='#6ade57'>SERVER</font></b> "+userName+" <font color='#fc0000'>"+msg+"</font>\n"
}
ConsoleTxt.verticalScrollPosition = ConsoleTxt.maxVerticalScrollPosition
}