Jump to content

Facebook share popup onInputDown / focus issue


kleepklep
 Share

Recommended Posts

I have an button in my game where I am popping a Facebook share window using Facebook SDK for JavaScript. When I interact with the popup and close it, the entire game show's a hand cursor and behaves as if it is the button. Anywhere I click on the screen will launch the popup again. I found that I can stop this behavior by adding the code at the bottom of this function, but then I have to click on the game to regain its focus before I can click on another button. Anyone have any ideas on how to deal with this?

 

shareThis.inputEnabled = true;shareThis.input.useHandCursor = true;shareThis.events.onInputDown.add(function () {	share(shareTitles[level - 1], shareMessages[level - 1], shareImgPath + 'icon_level' + level + '.jpg');	// I can stop the whole game acting like a button thing by doing this...	shareThis.inputEnabled = false;	shareThis.inputEnabled = true;	shareThis.input.useHandCursor = true;	// ...but then I have to click on the game once to regain its focus before I can interact with it again});
Link to comment
Share on other sites

  • 2 weeks later...

I just figured out some trickery to deal with this!

I noticed that when I click back onto the game and I'm over a button with an onInputOver listener it fires because the first click brings the game in focus, then the game reads that the pointer is over that button. game.input.activePointer.isDown reads as false even though the button is down so I can't use that, but game.input.activePointer.totalTouches reads as 0. So, if I put this in my onInputOver listeners it will read as if the button was pressed!

 

if (!game.input.activePointer.totalTouches) {	game.input.activePointer.totalTouches = 1;	thisButton.onPressed();}
This is a bit of a hack, so if there is another way to force the game back into focus so I don't have to do this please do share.
Link to comment
Share on other sites

  • 3 weeks later...
 Share

  • Recently Browsing   0 members

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