Jump to content

How to get Button.onInputUp fired when the pointer entered in a down state


ttk
 Share

Recommended Posts

I'm trying to build a button for mobile devices with the following characteristics:

  • The button goes down when there is a pointer in a down state over it
  • The button goes up when there are no pointers in a down state over it
var myButton = game.add.button(x,y,'myButton');myButton.inputEnabled = true;myButton.onInputDown.add(goDown,myButton);myButton.onInputOver.add(goDown,myButton);myButton.onInputUp.add(goUp,myButton);myButton.onInputOut.add(goUp,myButton);function goUp(){        this.isDown = false;}function goDown(){        this.isDown = true;}

Everything works fine except for when the button goes down because of `onInputOver` but doesn't go up when the pointer goes up (in a mobile device, when a pointer goes over, it is necessarily in a down state).

 

Apparently Phaser looks for  `onUp` events only from pointers who were pressed directly on the button. :ph34r:

 

How can I get the result I'm looking for?

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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