VincentMeier Posted August 30, 2015 Share Posted August 30, 2015 The Phaser buttons seem to have a bug, as onInputOver doesn't fire for a short time after any part of the game area is clicked. This becomes a problem very often for me, since I'm making a menu for my game and when I click on 'New game' button for instance, 3 save file buttons pop up and if I move my mouse over one of them the highlighting effect doesn't appear. And I also have a UI that shows the description of what the button does to the player on mouse over, which doesn't appear in this situation since the onInputOver hasn't fired. You might be thinking that perhaps I'm holding the click down as I move the mouse, but no, I have let go of the click even before moving the mouse. I made a simple code to test if this happens even in simple situations, to check if my own code isn't somehow creating this behaviour and yes it still the case. Here is the code, a video with audio cues on when I click and how the button highlighting doesn't happen after the click. https://www.youtube.com/watch?v=Hzdh4tl8DF8var game = new Phaser.Game(window.innerWidth, window.innerHeight, Phaser.AUTO, '', { preload: preload, create: create, update: update });function preload() { game.load.spritesheet('main_menu_game', 'assets/menu_items/main_menu_game.png', 128, 40);}function create() { var button; button = game.add.button(30, 30, 'main_menu_game', function () { }, this, 1, 0); button.events.onInputOver.add(function () { }, this); button.events.onInputOut.add(function () { }, this); button = game.add.button(200, 80, 'main_menu_game', function () { }, this, 1, 0); button.events.onInputOver.add(function () { }, this); button.events.onInputOut.add(function () { }, this);}function update() {} Link to comment Share on other sites More sharing options...
VitaZheltyakov Posted August 30, 2015 Share Posted August 30, 2015 Use button1 and button2 Link to comment Share on other sites More sharing options...
VincentMeier Posted August 30, 2015 Author Share Posted August 30, 2015 Use button1 and button2Tried it. Same result. Also, just checked and found that the phaser example has this same behaviour: http://phaser.io/examples/v2/buttons/action-on-clickIf you click somewhere outside the button and quickly move the mouse to the button, the over frame doesn't appear. Link to comment Share on other sites More sharing options...
Recommended Posts