AS3中的SpaceBar字符问题

时间:2013-02-21 00:16:13

标签: actionscript-3 virtual-keyboard

我正在使用虚拟键盘,但我的空间键给了我一些问题。当它被按下时,它会创造出空间,但它却在物理上显示出来。当我按下正常的字母或数字键时,现在可以看到空格,前面有字母。键盘和空格代码几乎完全相同。

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是我的问题的原因,但我不能确定。

想知道一些创意修复可能有用,如果有这样的事情,我一直在考虑使用空白符号。

0 个答案:

没有答案
相关问题