Input text in HaxeFlixel?

446 views
Skip to first unread message

Dlean Jeans

unread,
Jul 27, 2015, 12:13:42 AM7/27/15
to haxef...@googlegroups.com


I need a text field that also lets player enter text from the keyboard. So I've tried flixel.addons.ui.FlxInputText but its text is kinda blur. And then I learned that I can add OpenFL display objecst through BitmapData and add them to FlxSprite. So I tried to add OpenFL text field with input mode enabled something like this but it's impossible to click the text I edit them with keyboard:

var tf:TextField = new TextField();
tf.text = "TextField";
tf.backgroundColor = FlxColor.TRANSPARENT;
tf.type = TextFieldType.INPUT;
var bd:BitmapData = new BitmapData(200, 100);
bd.draw(tf);
var canvas:FlxSprite = new FlxSprite(350, 100);
canvas.pixels = bd;
add(canvas);

So there are 2 options:
1. Somehow add a OpenFL text field with input mode enabled to HaxeFlixel FlxState
2. Somehow make FlxInputText's text smoother (EDIT: my eyes must be confused, it just got itself smoother)

Gama11

unread,
Jul 28, 2015, 10:03:07 AM7/28/15
to haxef...@googlegroups.com, dlean...@gmail.com, dlean...@gmail.com
If you don't need to display any FlxSprites over the text field, you should be fine adding it directly to the stage on top of flixel's camera sprite like so:

FlxG.addChildBelowMouse(tf);
Reply all
Reply to author
Forward
0 new messages