class TextInputField extends TextField
{
var _textFormat:TextFormat;
public var _conf:Dynamic;
public var validateSignal:Signal2<TextField, String>;
public function new()
{
super();
KeyBinding.addOnRelease(Keyboard.ENTER, onKeyRelease);
this.selectable = true;
}
public function onTextFieldAdded(e:Event):Void
{
removeEventListener(Event.ADDED_TO_STAGE, onTextFieldAdded);
this.type = flash.text.TextFieldType.INPUT;
Reflect.field(this, 'nmeGraphics').nmeSurface.style.width = _conf.width + "px";
Reflect.field(this, 'nmeGraphics').nmeSurface.style.height = _conf.height + "px";
Reflect.field(this, 'nmeGraphics').nmeSurface.style.overflow = "hidden";
if( this.wordWrap ){
Reflect.field(this, 'nmeGraphics').nmeSurface.style.whiteSpace = "normal";
}else{
Reflect.field(this, 'nmeGraphics').nmeSurface.style.whiteSpace = "nowrap";
}
if (_conf.embedFonts) {
Reflect.field(this, 'nmeGraphics').nmeSurface.style.setProperty("font-family", _conf.fontPath);
}
Reflect.field(this, 'nmeGraphics').nmeSurface.innerHTML = '';
}
function onKeyRelease()
{
validateSignal.dispatch(this, this.get_Text());
}
public function get_Text():String {
var text:String = StringTools.replace( Reflect.field(tf, 'nmeGraphics').nmeSurface.innerHTML,
' ', ' ' ).split("<")[0];
return text;
}
}
Thank you again Alexander. You put me on right track, and maybe the webfonts trick can help you with StablexUI.