0

現在、2 つのテキスト フィールドに基づいて送信ボタンを無効にするフォームがあります。1 つのフィールドはメッセージ ボックスです。人がたくさんのエンターとスペースを入れないようにしたいです。現在、スペースのチェックを行っていますが、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;
        }
4

1 に答える 1