移动设备上的TLFTextField(ios/android)
问题描述:
我正在为android和ios编写空气移动应用程序,我必须使用TLFTextField,因为我需要RTL(heb)。
我遇到了TLFTextField的所有渗透性工作
当我点击文本框并设置焦点SoftKeyboard没有显示 所以我不得不让它显示从代码然后即使当键盘是打开文本框没有得到按键并保持空白。 任何想法或建议将受到欢迎?移动设备上的TLFTextField(ios/android)
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;
}
答
该解决方案可能不会使用这个类在所有,但使用StageText的 http://blogs.adobe.com/cantrell/archives/2011/09/native-text-input-with-stagetext.html