如果在FLEX textArea中有else语句

时间:2012-02-15 21:17:00

标签: actionscript-3 flex flash-builder

我有一个if else语句,将语言Capability IN更改为ENGLISH。

问题在于它覆盖了其他功能。

txtbox1.text = Capabilities.version + "\n" 
                + "\n" +Capabilities.isDebugger + "\n" +Capabilities.os
                + "\n" +Capabilities.playerType 

                    if(Capabilities.language == "en"){
                        txtbox1.text = "language: English";
                }
                else if (Capabilities.language.toLowerCase() == "sv"){
                    txtbox1.text = "language: swedish";
                }
                else {
                    txtbox1.text = "language: Other";
                }
                ;

感谢。

1 个答案:

答案 0 :(得分:1)

var language : String = "";
if(Capabilities.language.toLowerCase() == "en")
    language = "language: English";
else if (Capabilities.language.toLowerCase() == "sv")
    language = "language: swedish";
else
    language = "language: Other";

txtbox1.text = Capabilities.version 
            + "\n" + Capabilities.isDebugger
            + "\n" + Capabilities.os
            + "\n" + Capabilities.playerType 
            + "\n" + language;