As3 Text Manipulation - Как сказать "if charAt == Возврат каретки"?

В настоящее время у меня есть форма, которая отключает кнопку отправки на основе двух текстовых полей. Одно поле - это окно сообщения. Я хочу, чтобы человек не мог просто вставить кучу входов и пробелов. В настоящее время я проверяю пробелы, но charAt просто возвращает пробел:/ Вот как я хочу, чтобы он выглядел так:

        _sendComposeBtn.visible = true;

              // if the length of the message is zero, don't let people send it
        if (_messageLength == 0)
        {
            trace("hiding");
            _sendComposeBtn.visible = false;
            _realMessage = false;
        }


        _allSpaces = true;
              // start with allSpaces true. If there is a nonspace (or non-enter character then hide send button                
        for (i = 0; i < _bigMessageTextField.length; i++)
        {
            if (_bigMessageTextField.text.charAt(i) != " " && _bigMessageTextField.text.charAt(i) != (ENTER_CHARACTER))
            {
                trace("not a space");
                _allSpaces = false;
            }
        }

        if (_allSpaces == true)
        {
            _sendComposeBtn.visible = false;
        }

1 ответ

Ты можешь сказать:

_bigMessageTextField.text.charAt(i) != String.fromCharCode(13)
Другие вопросы по тегам