Jump to content

Phaser stops HTML forms working?


xronn
 Share

Recommended Posts

Hello, 

So I'm just about to add a real time chat widget to my Phaser game, but for some reason Phaser stops me from adding spaces between words in input fields and textareas. When I comment out the var game = new Phaser.game jazz it allows me to put spaces in these fields. 

Any ideas?

 

 

Link to comment
Share on other sites

This is what I have everything loads and renders fine but with the script tag at the bottom you can't have spaces in the input or textarea.

 

        <div class="container">            <div class="content">                <div id="pixelquest">                </div>                <div class="chat-widget">                    <div class="chat-messages"></div>                    <div class="input-area">                        <input type="text" class="chat-name" placeholder="Your name">                        <textarea class="chat-entry" placeholder="Type a message and hit enter"></textarea>                    </div>                </div>            </div>        </div>    <script>        window.onload = function() {            var game = new Phaser.Game(800, 720, Phaser.AUTO, 'pixelquest');            game.state.add('Boot', pixelquest.Boot);            game.state.add('Preloader', pixelquest.Preloader);            game.state.add('MainMenu', pixelquest.MainMenu);            game.state.add('Game', pixelquest.Game);            //  Now start the Boot state.            game.state.start('Boot');        };    </script>
Link to comment
Share on other sites

I keep seeing people asking for help and receiving a solution from others, but then marking their own comments on that assistance as the "best answer". Maybe this shouldn't bother me (ultimately it's meaningless), but it seems really rude especially when you don't even thank the people who helped you.

The best answer is the person that psychically debugged your issue, not you for noticing they were right! lol :P

Link to comment
Share on other sites

Hmm, it seems to me that you are experiencing a focus() issue.

 

How is that chat-widget being instantiated?  what js are you using to create it?  Are you using any third party libs like tiny MCE??  (many of them much with the focus())

 

You can also try moving the chat widget inside a different DOM element, perhaps at the top, also you could try setting its z-index:9999 to see if focus is bubbling up to the canvas.

 

You can also try setting the position of the chat widget to fixed to see what happens.

 

I wish I could be more help, but this is what I would do in your position given the amount of knowledge of the project you have provided.

 

I hope it does help though!

 

EDIT: Oh I see, phaser.js binds keys to the window..  Curious as to why it would do that, I mean, shouldn't it bind only to the element it is residing in? Why does it bind to window for things?  I generally try to avoid that unless absolutely necessary.. am curious as to what that would be for phaser.

Edited by MattMcFarland
Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...