azerion / phaser-input

Adds input boxes to Phaser like CanvasInput, but also works for WebGL and Mobile, made for Phaser only.
MIT License
201 stars 64 forks source link

z-index not working #29

Closed EricMatthews1993 closed 7 years ago

EricMatthews1993 commented 7 years ago

First, thank you for this great input box! I altered it a little bit to allow submitting to a callback upon pressing enter.

Anyway, I am trying to set the z-index of the component, but am having no effect. The text box goes over most of my game sprites, except for text that I have at a specific z-index.

How can I make sure that the text box is above everything?

Thank you

AleBles commented 7 years ago

it kinda depends on what you mean. We have a html input field which is offset in such a way that it doesn't appear on screen. You can set the z-index on this element but it indeed won't have any effect.

Then there is also the InputField object which behaves like a Phaser.Sprite, so you should be able to put it on top with the build-in phaser methods: bringToTop.

And as with other Sprites, the order of appearance equals the order of adding them to the stage.