Jump to content

How do I change behavior of button?


San4er
 Share

Recommended Posts

  • 2 weeks later...

This is usually the desired behaviour, but you can make it work the way you're wanting like so:

button.onInputUp.add(function(button, pointer, isOver) {  if (isOver) {    // do something here  }}, this);

The callback returns the button pressed, the pointer used to press it and whether the pointer was over the button when the event happened, which is handy for these situations.

Link to comment
Share on other sites

I made exactly it like you said.

Here how it works now:

1. I make inputDown over the button.

2. I move cursor out of the button and then make inputUp. So it seems like button hasn't been pressed.
3. BUT now if I move my cursor Over the button it changes it's frame to inputDown or inputUp without making anything from *do something here*.

 

Maybe there is already some function there and I can DELETE it, not ADD? Or it is a bug?

Link to comment
Share on other sites

If it's the frame the button displays that you need to remain consistent with your functionality then you may have to delve into the Button object and extend it as needed, as I think the frame stuff may not be easily configurable. As I say, it's not usually desirable to have the button 'stick on' if the user moves off it and releases the mouse button/lifts their finger. Can you describe what it is you're trying to do that would need this specific behaviour?

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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