Jump to content

Event onInputOut not launched when button.visible set to false after click


Sebastien
 Share

Recommended Posts

Hi,

I have several buttons in my game and I want them to disappear when I click on it. But it seems that the event "onInputOut" is not fired when I set the property button.visible = false in the callback function of the button. Is this a normal behaviour ? Because this causes some problems in my game logic.


Is there a way to force the event "onInputOut" to be launched ? I tried button.onInputOut.dispatch() but it does not work.

Thanks :)

Link to comment
Share on other sites

I think hiding a button while it's underneath the cursor doesn't count as inputOut. You would have to move the cursor off the button, possibly while it's still visible.

You can do either

button.onInputOutHandler(button, pointer);
// or
button.onInputOut.dispatch(button, pointer);

You can use the pointer reference you receive in the click handler.

Link to comment
Share on other sites

 

I did what you said, and it lauched the onInputOut event, however a problem persists.

When I click on a construction site to build a tower, I see my 4 buttons, and when the cursor is over one of these buttons, the border of the button gets brighter.

When I click on one of these button, a tower is getting build and the 4 buttons disappear. But if after that I click on another construction site in the map, the button corresponding of the type of tower I builded earlier still is visually in his "over" state, judging by his border which is brighter.

img15.jpg

img16.jpg

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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