Actionscript 3:Combobox不工作?

时间:2014-06-12 13:54:06

标签: actionscript-3 flash combobox

我有这段代码用于更改flash中文本字段中htmlText的颜色。当我按下sendBtn时,它意味着从inputTxt和userTxt获取文本并对它们进行排序,以便它们进行基本的聊天。

当我按下发送时,文本框都被清除但是没有发送消息,这意味着问题是组合框。

到目前为止,我的代码是:

import flash.events.MouseEvent;
import flash.events.KeyboardEvent;

outputTxt.htmlText = "\n" + "<font color = '#3E8697'><i>Welcome to chat room omega! You're the only person here!</i></color>" + "\n" + "" + "\n";

joinBtn.addEventListener(MouseEvent.CLICK, clickJoinRoom);
function clickJoinRoom(event:MouseEvent){
    if(roomTxt.length > 0){
        outputTxt.htmlText = "\n" + "<font color = '#3E8697'><i>Welcome to chat room</color>" + " " + roomTxt.text + "! You're the only person here!</i></color>" + "\n" + "" + "\n";
    }
}

sendBtn.addEventListener(MouseEvent.CLICK, sendMessage);

function sendMessage(event:MouseEvent){
    if(userTxt.length > 0 && inputTxt.length > 0){
       if(rankingBox.selectedItem == "member"){
        outputTxt.htmlText += "<font color = '#047B7B'><u>" + userTxt.text + "</u><font color = '#666666'>: " + inputTxt.text;
        }
        if(rankingBox.selectedItem == "mod"){
            outputTxt.htmlText += "<font color = '#1C369F'><u>" + userTxt.text + "</u><font color = '#666666'>: " + inputTxt.text;
        }
        if(rankingBox.selectedItem == "admin"){
            outputTxt.htmlText += "<font color = '#870A6F'><u>" + userTxt.text + "</u><font color = '#666666'>: " + inputTxt.text;
        }
        userTxt.text = "";
        inputTxt.text = "";
        userTxt.htmlText = "";
        inputTxt.htmlText = "";
    }
}

0 个答案:

没有答案