Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FlxInputText Crashes when given a background color #210

Open
piboistudios opened this issue Sep 17, 2018 · 3 comments
Open

FlxInputText Crashes when given a background color #210

piboistudios opened this issue Sep 17, 2018 · 3 comments

Comments

@piboistudios
Copy link

When providing a background color for FlxInputText widgets via an XML generated FlxUI the game crashes with this error:

Uncaught TypeError: Cannot read property 'bitmap' of null
    at flixel_graphics_tile_FlxDrawQuadsItem.render (:8080/static/games/tinsdalia-hf/Tinsdalia/export/html5/bin/Tinsdalia.js:39151)
    at flixel_FlxCamera.render (:8080/static/games/tinsdalia-hf/Tinsdalia/export/html5/bin/Tinsdalia.js:7238)
    at flixel_FlxGame.draw (:8080/static/games/tinsdalia-hf/Tinsdalia/export/html5/bin/Tinsdalia.js:10397)
    at flixel_FlxGame.onEnterFrame (:8080/static/games/tinsdalia-hf/Tinsdalia/export/html5/bin/Tinsdalia.js:10229)
    at openfl_events__$EventDispatcher_Listener.f [as callback] (:8080/static/games/tinsdalia-hf/Tinsdalia/export/html5/bin/Tinsdalia.js:124503)
    at openfl_display_Stage.__dispatchEvent (:8080/static/games/tinsdalia-hf/Tinsdalia/export/html5/bin/Tinsdalia.js:1086)
    at openfl_display_Stage.__dispatch (:8080/static/games/tinsdalia-hf/Tinsdalia/export/html5/bin/Tinsdalia.js:2002)
    at openfl_display_Stage.__broadcastEvent (:8080/static/games/tinsdalia-hf/Tinsdalia/export/html5/bin/Tinsdalia.js:113546)
    at openfl_display_Stage.render (:8080/static/games/tinsdalia-hf/Tinsdalia/export/html5/bin/Tinsdalia.js:113360)
    at Array.f (:8080/static/games/tinsdalia-hf/Tinsdalia/export/html5/bin/Tinsdalia.js:124503)
:8080/static/games/tinsdalia-hf/Tinsdalia/export/html5/bin/Tinsdalia.js:124444 Uncaught TypeError: Cannot read property 'setMode' of null
    at resize (:8080/static/games/tinsdalia-hf/Tinsdalia/export/html5/bin/Tinsdalia.js:124444)
@larsiusprime
Copy link
Member

What target? Looks like html5? Can you post a reproduction sample? (Your xml markup for instance?)

@piboistudios
Copy link
Author

piboistudios commented Sep 17, 2018

Yeah, here's the markup:

<?xml version="1.0" encoding="utf-8" ?>
<data><include name="00definitions"/>
  <chrome use_def="chrome" group="ui_fatboi" width="640" height="72" y="72" center_x="true" id="head"></chrome>
  <text size="48" color="#aba521" shadow="#222222" border_quality="1.0" text="Create Your Destiny" width="head.width-6" align="center">
    <anchor y="head.top + 80" y-flush="top" x-flush="left"></anchor>
  </text>
  <chrome use_def="chrome" group="ui_fatboi" width="head.width" height="512" y="head.bottom+8" x="head.left" id="body1"></chrome>
  <chrome use_def="chrome" group="ui_fatboi" width="body1.width-48" height="body1.height/2" y="body1.top+48" id="general" x="body1.left+32"></chrome>
  <text shadow="#222222" color="#cddfaa" id="general_title" size="32" text="General - " width="general.width">
    <anchor y="general.top-48" x="general.left+24"></anchor>
  </text>
  <region group="ui_fatboi" width="general.width/2" height="general.height" id="general_col1">
    <anchor x="general.left" x-flush="left" y="general.top" y-flush="top"></anchor>
  </region>
  <text group="ui_fatboi" text="Name" anchor="center" size="24" x="general_col1.left+16" y="general_col1.top+12" id="name_label"></text>
  <input_text group="ui_fatboi" width="general_col1.width/2" id="name_input" height="24" color="#dddddd" background="#ffffff">
    <anchor x="name_label.right+16" x-flush="left" y="name_label.top" y-flush="top"></anchor>
  </input_text>
  <input_text group="ui_fatboi" width="general_col1.width" id="family_label" height="24" color="#dddddd" background="#ffffff">
    <anchor x="general_col1.left" y="name_label.bottom+4"></anchor>
  </input_text>
</data>

Both input texts seem to work fine without a background color, but they don't render a UI sprite.

@Gama11
Copy link
Member

Gama11 commented Jan 22, 2019

#216 has a code example:

package;

import flixel.FlxState;
import flixel.addons.ui.FlxInputText;

class PlayState extends FlxState
{
	override public function create():Void
	{
		var tf:FlxInputText = new FlxInputText(50, 100, 300);
		tf.borderColor = 0xFFFFFFFF;
		tf.x = 50;
		tf.y = 200;
		tf.width = 300;
		tf.height = 15;
		tf.caretWidth = 5;
		tf.callback = speakUp;
		add(tf);
	}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants