flixel-ui icon indicating copy to clipboard operation
flixel-ui copied to clipboard

Can't use FlxUIInputText .resize() in create.

Open kamilko opened this issue 5 years ago • 0 comments

Haxe version: 3.4.7 Lime version: 7.3.0 Flixel version: 4.6.1 Build: html5 OS: macOS 10.14.4 Browsers: FF66.0.3, Opera58.0.3135.132, Safari12.1

If I try set the width for newly created component of FlxUIInputText like this:

input = new FlxUIInputText(10, 580, 200);

or this:

input = new FlxUIInputText(10, 580);
input.resize(200, 24);

and start to write whatever in such input field I get this error in browser and game hangs:

Called from module __handleError@http://127.0.0.1:3000/SimpleGame.js:116020:40
Called from module __broadcastEvent@http://127.0.0.1:3000/SimpleGame.js:115848:7
Called from module __onLimeRender@http://127.0.0.1:3000/SimpleGame.js:116828:3
Called from module f@http://127.0.0.1:3000/SimpleGame.js:130999:233
Called from module dispatch@http://127.0.0.1:3000/SimpleGame.js:75636:16
Called from module handleApplicationEvent@http://127.0.0.1:3000/SimpleGame.js:351:6
Called from module f@http://127.0.0.1:3000/SimpleGame.js:130999:233
Called from module

TypeError: shader is null[Learn More] SimpleGame.js:37658:3
    render http://127.0.0.1:3000/SimpleGame.js:37658
    render http://127.0.0.1:3000/SimpleGame.js:8313
    draw http://127.0.0.1:3000/SimpleGame.js:11506
    onEnterFrame http://127.0.0.1:3000/SimpleGame.js:11334
    f http://127.0.0.1:3000/SimpleGame.js:130999
    __dispatchEvent http://127.0.0.1:3000/SimpleGame.js:1179
    __dispatch http://127.0.0.1:3000/SimpleGame.js:1941
    __broadcastEvent http://127.0.0.1:3000/SimpleGame.js:115844
    __onLimeRender http://127.0.0.1:3000/SimpleGame.js:116828
    f http://127.0.0.1:3000/SimpleGame.js:130999
    dispatch http://127.0.0.1:3000/SimpleGame.js:75636
    handleApplicationEvent http://127.0.0.1:3000/SimpleGame.js:351
    f http://127.0.0.1:3000/SimpleGame.js:130999

Safari even hangs while you try to open such scene where in create is input.resize(). But when I remove all the size setup from create method and put in update - besides ugly flickering sometime while you typing fast, everything works fine. Maybe not everything. You can't erase first letter, it stays and if you start write again, it will be overwritten. Another workaround is to set some input.text while you create the component. But if you need it empty at beginning, then you must use update workaround.

You can easily check this bug with online demo: http://haxeflixel.com/demos/Calculator/ but you don't want to use number buttons but enter number from keyboard. If you first press some button number, and then work with keyboard it will be all fine (except that bug with first number left after delete).

kamilko avatar Apr 28 '19 10:04 kamilko