rexrainbow / phaser3-rex-notes

Notes of phaser3 engine
MIT License
1.18k stars 259 forks source link

Set textbox element #361

Closed dtturcotte closed 1 year ago

dtturcotte commented 1 year ago

Hello, I'm using your awesome RexUI textbox. I initialize the "background" property to a rounded rectangle. But at some point in my game, I want to set a texture to the textbox background. The rounded rectangle doesn't have a texture property, so I figured the best way to do that would be set the "background" to an image object. The textbox, however, doesn't seem to have a setElement(...) method, only a getElement(...) method. Any suggestions?

rexrainbow commented 1 year ago

Remove background child then add a new one. See this new demo, line 55-63. sizer.removeBackground method is existed but not in document, will add it to document. TextBox is extended from Label (Label is extended from Sizer)

dtturcotte commented 1 year ago

Thank you!