0

我正在使用虚拟键盘,但我的空格键给了我一些问题。当它被按下时,它创造了空间,但它没有物理显示。当我按下一个普通的字母或数字键时,空格现在是可见的,字母在它前面。键盘和空格代码几乎相同。

function _keys(event:MouseEvent):void
{
    textSelect.setSelection(textSelect.length, textSelect.length);

    if(electoff.currentFrame == 2)
    {
        ajWidth(event);
    }

    if(terminalinput.currentFrame == 2)
    {
        TrWidth(null);
    }

    if (control == "on" && menu.visible == false ) 
    {
        if (! shift)
        {
            textSelect.appendText(letterButtonSmall[event.target.name]);
        }
        else
        {
            textSelect.appendText(letterButtonCaps[event.target.name]);
            shift = false; 
        }

        savedTxt = textSelect.text;
        textSelect.setSelection(textSelect.length, textSelect.length);

        if(textSelect.width <= 134.05 && textSelect == inputClips.inputTxt )
        {
            textSelect.autoSize = TextFieldAutoSize.LEFT;
            textSelect.x = 1.2;
        }

        if (textSelect.width >= 134.05 && textSelect == inputClips.inputTxt)
        {
            textSelect.autoSize = TextFieldAutoSize.LEFT;
            textSelect.x = 1.2 - (textSelect.width-134.05);
        }
    }

    textSelect.setSelection(textSelect.length, textSelect.length);

    if(electoff.currentFrame == 2)
    {
        ajWidth(event);
    }

    if(terminalinput.currentFrame == 2)
    {
        TrWidth(null);
    }

    focuser();
    strehrows3();
    _fontSize();
}


//spaces
key_space.addEventListener(MouseEvent.CLICK, spaceClickListener);
function spaceClickListener(e:MouseEvent):void
{
    strehrows3();
    textSelect.setSelection(textSelect.length,textSelect.length);
    if (electoff.currentFrame == 2)
    {
        ajWidth(null);
    }
    if (terminalinput.currentFrame == 2)
    {
        TrWidth(null);
    }
    if (control == "on" && menu.visible == false )
    {
        if (! shift)
        {
            textSelect.appendText(" ");
        }
        else
        {
            textSelect.appendText(" ");

            shift = false;
        }
        savedTxt = textSelect.text;
        textSelect.setSelection(textSelect.length,textSelect.length);
        if (textSelect.width <= 134.05 && textSelect == inputClips.inputTxt )
        {
            textSelect.autoSize = TextFieldAutoSize.LEFT;
            textSelect.x = 1.2;
        }
        if (textSelect.width >= 134.05 && textSelect == inputClips.inputTxt)
        {
            textSelect.autoSize = TextFieldAutoSize.LEFT;
            textSelect.x =  1.2-(textSelect.width-134.05);
        }
    }
    textSelect.setSelection(textSelect.length,textSelect.length);
    if (electoff.currentFrame == 2)
    {
        ajWidth(null);
    }
    if (terminalinput.currentFrame == 2)
    {
        TrWidth(null);
    }

        focuser();
        strehrows3();
        _fontSize();
}

现在我怀疑 autoSize 是造成我的问题的原因,但我不能确定。

想知道一些创造性的修复可能会起作用,我一直在考虑是否有这样的事情使用空白符号。

4

0 回答 0