Jump to content

Making a button activate when the mouse pointer is over it and a mouse button is pressed?


Qzlmnrk
 Share

Recommended Posts

The onInputDown handler only works if you press the mouse button after you hover over the button.  If you hold down the mouse button and then hover over the button, it does nothing.  I want to be able to activate the button by just hovering over it with the mouse button held down, even if I don't "click" per se.

Link to comment
Share on other sites

I am not sure what you mean, still want to help ;) Are you looking something like this (the btnover functionality):

function create() {  button = game.add.button(100, 1, 'button', btnclick, this);  button.onInputOver.add(btnover, this);}function btnclick() {  console.log('button click');}function btnover() {  console.log('button over');}

Same thing in JSFiddle: https://jsfiddle.net/88jL1bLh/1/   (imagine that hello world as button)

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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