2

everybody!

I'm creating a small game

I have a popup that is shown when the cursor is over an element

Here is the method of creating a sprite:

createSprite: function(x, y, elementName) {
    var obj = game.add.sprite(x, y, elementName);
    //smth
    obj.events.onInputOver.add(this.activeSlot, this);
    //smth

    return obj;
}

here is the Method that is called when the cursor is over a sprite:

activeSlot: function(overElement) {
    //smth
    this.showPopupItem(overElement);
}

And here is showPopupItem method:

showPopupItem: function(overedElement) {
 //here I'm creating sprites and images that are shown
}

The popup is destroyed when the cursor is not over an element


Everything works fine, BUT here is one problem:

When I am hovering a sprite and then change the screen via four fingers on MAC OS, then I move mouse and so on, and then again the screen of the game is opened the popup doesn't hide at all


I wonder, what can I do with that

Thank you in advance for your answer) Good luck!

weratius
  • 113
  • 1
  • 12
  • I know you're using jquery, but if you can relate to the equivalent Objective-C code, perhaps [this may help](http://stackoverflow.com/questions/2414111/detecting-when-a-space-changes-in-spaces-in-mac-os-x) to point you in the right direction – TheDarkKnight Jun 05 '15 at 12:49
  • @TheDarkKnight that's the main thing: my game is browser one – weratius Jun 05 '15 at 14:22

1 Answers1

0

You can listen for the onTouchCancel event. Documentation.

Kamen Minkov
  • 3,324
  • 1
  • 14
  • 21