Ruhul Amin Posted July 9, 2017 Share Posted July 9, 2017 i am new in phaser and successfully made a game.But the problem i faced is when i compile it with phone gap or intel XDK the the phone button like backbutton doesn't work properly.The whole game exit in one press of back button. I want to use a confirmation massge like "Do you want to exit " like general app does.After conformation the game will exit.How can i do this?...It will be very kind of you and helful if you answer ...Thanks in Advance. Link to comment Share on other sites More sharing options...
bruno_ Posted July 9, 2017 Share Posted July 9, 2017 You have to add an event listener to "backbutton". See this example: https://cordova.apache.org/docs/en/4.0.0/cordova/events/events.backbutton.html Link to comment Share on other sites More sharing options...
Ruhul Amin Posted July 10, 2017 Author Share Posted July 10, 2017 Thank you very much sir....Can i use this kind of events in the state of the game instead of in the index file,if yes then please give a tutorial.Thanks again.. Link to comment Share on other sites More sharing options...
bruno_ Posted July 10, 2017 Share Posted July 10, 2017 You can put the event handler anywhere. I recommend creating it as soon as possible, and only once. Just put these lines where you need: document.addEventListener("backbutton", onBackKeyDown, false); function onBackKeyDown() { // Handle the back button } Link to comment Share on other sites More sharing options...
Ruhul Amin Posted July 10, 2017 Author Share Posted July 10, 2017 Thank you very much sir I will post if i face any problem........ Link to comment Share on other sites More sharing options...
Recommended Posts