The demo I have found for allowing text field input works fine when targeting windows, but throws an error when targeting mac or linux.
The error states “pointer being released was not allocated”, and I can’t see how it applies here. Any help in fixing this bug would be greatly appreciated.
EDIT: To be a little more specific, i’ve found this is to do with the textfield.text property - if this is set as a default the program will crash with the error above. If this line is removed the program will initialize, but clicking inside the textfield causes the same error.
package;
import openfl.display.Sprite; import openfl.events.Event; import openfl.text.TextField; import openfl.text.TextFieldType; import openfl.text.TextFormat;
class Main extends Sprite { public function new () { super (); addEventListener(Event.ADDED_TO_STAGE, init); } private function init(e:Event):Void { removeEventListener(Event.ADDED_TO_STAGE, init); var textfield = new TextField(); textfield.x = 540; textfield.y = 440; textfield.type = TextFieldType.INPUT; textfield.selectable = true; textfield.textColor = 0x000000; textfield.border = true; textfield.borderColor = 0xFFFF00; textfield.background = true; textfield.backgroundColor = 0xFFFFFF; textfield.text = 'sample'; textfield.width = 200; textfield.height = 40; textfield.setTextFormat(new TextFormat(null, 32)); //Mobile stuff #if (android || ios) textfield.needsSoftKeyboard = true; //textfield.softKeyboardInputAreaOfInterest = new Rectangle(540, 440, 200, 40); textfield.moveForSoftKeyboard = true; #end addChild(textfield); } }