使用 flash pro 在虚拟键盘上工作,我有点卡住了。我有一种控制克拉的方法,因此您可以滚动浏览文本字段,但我希望能够准确地在克拉使用代码的位置打入字母。
下面是我的键盘控件
// keyboard controls
for (var i=0; i<lettersSmall.length; i++)
{
this["key_" + lettersSmall.charAt(i)].addEventListener(MouseEvent.MOUSE_UP,_keys);
letterButtonSmall["key_" + lettersSmall.charAt(i)] = lettersSmall.charAt(i);
letterButtonCaps["key_" + lettersSmall.charAt(i)] = lettersCaps.charAt(i);
}
function _keys(event:MouseEvent):void
{
curTextPos = textSelect.caretIndex;
strehrows3();
stage.focus = textSelect;
textSelect.setSelection(curTextPos,curTextPos);
if (electoff.currentFrame == 2)
{
ajWidth(event);
}
if (terminalinput.currentFrame == 2)
{
TrWidth(null);
}
if (control == "on" && menu1.visible == false )
{
if (! shift)
{
textSelect.appendText(letterButtonSmall[event.target.name]);
inputMaxWidth = textSelect.width;
}
else
{
textSelect.appendText(letterButtonCaps[event.target.name]);
shift = false;
inputMaxWidth = textSelect.width;
}
savedTxt = textSelect.text;
textSelect.setSelection(textSelect.length,textSelect.length);
if (textSelect.width <= 134.05)
{
//textSelect.autoSize = TextFieldAutoSize.LEFT;
textSelect.x = 1.2;
}
if (textSelect.width >= 134.05)
{
//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();
textSelect.width = inputMaxWidth;
}