我正在为Android和ios编写空中移动应用程序,我必须使用TLFTextField,因为我需要RTL(heb)。
我遇到了与TLFTextField相关的各种渗透工具
第一个事件,当我单击文本框并设置焦点时,SoftKeyboard没有显示
所以我不得不让它从代码中显示出来,即使当键盘打开时,文本框也没有按下按键并保持空白。
欢迎提出任何想法或建议吗?
public function BaseView()
{
super();
this.addEventListener(SoftKeyboardEvent.SOFT_KEYBOARD_ACTIVATE,onActive);
this.addEventListener(SoftKeyboardEvent.SOFT_KEYBOARD_DEACTIVATE,onDeactive);
}
protected function onDeactive(event:SoftKeyboardEvent):void
{
isKeyBordOpen = false;
trace("deactive")
}
protected function onActive(event:SoftKeyboardEvent):void
{
isKeyBordOpen = true;
trace("Active: " + event.type)
}
internal function addEventToTextFiled(textBox:TLFTextField):void
{
textBox.addEventListener(FocusEvent.FOCUS_IN,onFocus,false,0,true);
textBox.addEventListener(FocusEvent.FOCUS_OUT,onOutFocus,false,0,true);
}
internal function removeEventToTextFiled(textBox:TLFTextField):void
{
textBox.removeEventListener(FocusEvent.FOCUS_IN,onFocus);
textBox.removeEventListener(FocusEvent.FOCUS_OUT,onOutFocus);
}
internal function onOutFocus(event:FocusEvent):void
{
var txt:TLFTextField = event.currentTarget as TLFTextField;
setText(txt,txt.text);
}
internal function onFocus(event:FocusEvent):void
{
var txt:TLFTextField = event.currentTarget as TLFTextField;
if(isKeyBordOpen == false)
{
var isRisie:Boolean = txt.requestSoftKeyboard();
trace("isRisie:Boolean " + isRisie)
stage.focus = txt
}
setBlock(txt);
}
internal function setText(textBox:TLFTextField,txt:String):void
{
txt = StringUtil.trim(txt," ");
textBox.needsSoftKeyboard = true;
if(txt != null && txt.length > 0)
{
setBlock(textBox);
textBox.text = txt;
}
else
{
setTrans(textBox);
}
}
internal function setTrans(textBox:TLFTextField):void
{
textBox.background = false;
}
internal function setBlock(textBox:TLFTextField):void
{
textBox.background = true;
textBox.backgroundColor = 0xffffff;
}
答案 0 :(得分:0)
解决方案可能根本不使用此类,而是使用StageText http://blogs.adobe.com/cantrell/archives/2011/09/native-text-input-with-stagetext.html