I am trying to insert text at current cursor position.I am able to insert text at current cursor position by keyboard but not able to insert text by programmer made keyboard.
Asked
Active
Viewed 417 times
2
-
Could you show your code? – Anton Apr 06 '13 at 08:48
-
yes sir.i have simply concatenate it. – SKG486 Apr 06 '13 at 08:59
-
protected function greekalpha_clickHandler(event:MouseEvent):void { if(FlexGlobals.topLevelApplication.textTarget.visible) { FlexGlobals.topLevelApplication.textTarget.text = FlexGlobals.topLevelApplication.textTarget.text+ (event.target as Button).label; } } – SKG486 Apr 06 '13 at 09:01
-
what is programmer made keyboard? – csomakk Apr 08 '13 at 10:56
2 Answers
1
var pos:int = taMain.selectionActivePosition;
if (pos != -1)
{
taMain.text = taMain.text.substr(0, pos) + str + taMain.text.substr(pos, taMain.text.length - pos);
taMain.selectRange(pos + str.length, pos + str.length);
}
}
]]>
</fx:Script>

Sunil486
- 224
- 1
- 14
0
HI try with below code:-
protected function greekalpha_clickHandler(event:MouseEvent):void {
if(FlexGlobals.topLevelApplication.textTarget.visible) {
FlexGlobals.topLevelApplication.textTarget.setFocus();
FlexGlobals.topLevelApplication.textTarget.insertText((event.target as Button).label);
}
}

Mahesh Parate
- 786
- 1
- 4
- 13