Mattward Posted September 3, 2015 Share Posted September 3, 2015 Hi, This works when I run it in cordova: game.input.onUp.add(jump, this); However this doesn't: enPlayButton.onInputDown.muff.add(PlayFunction, this); And when I change it to use the first example, like so: enPlayButton.input.onUp.add(PlayFunction, this); It still won't work.. Does anyone know why? Here is the full code if you need it: http://pastebin.com/UyPh1U9F First example is on line 1728. Second example is on line 554. Link to comment Share on other sites More sharing options...
icp Posted September 3, 2015 Share Posted September 3, 2015 I got the same issue, everything works fine on fine on Desktop but on Cordova+Crosswalk the button remains in the down state. Mattward 1 Link to comment Share on other sites More sharing options...
icp Posted September 3, 2015 Share Posted September 3, 2015 Instead of using a button, I used a sprite which mimics the behavior of a button and now everything works well: this.toggleButton = this.game.add.sprite(0, 0, 'toggleButton'); this.toggleButton.frameName = 'onUp.png'; this.toggleButton.inputEnabled = true; this.toggleButton.events.onInputDown.add(downState, this); this.toggleButton.events.onInputUp.add(upState, this); this.toggle = false; function downState () { if(this.toggle === false) { this.toggleButton.frameName = 'onDown.png'; this.toggle = true; //add your callback } else{ this.toggleButton.frameName = 'offDown.png'; this.toggle = false; //add your callback } } function upState () { if(this.toggle === true) { this.toggleButton.frameName = 'offUp.png'; this.toggle = true; //add your callback } else{ this.toggleButton.frameName = 'onUp.png'; this.toggle = false; //add your callback } } Link to comment Share on other sites More sharing options...
Mattward Posted September 4, 2015 Author Share Posted September 4, 2015 This doesn't seem to work for me?I used this: this.homeButton = this.game.add.sprite(homeButtonX, homeButtonY, 'homeButton'); this.homeButton.inputEnabled = true; this.homeButton.events.onInputDown.add(HomeFunction, this);I can't figure out why?! The sprite displays and everything runs fine but nothing happens when I click it? Link to comment Share on other sites More sharing options...
icp Posted September 4, 2015 Share Posted September 4, 2015 What error does it output in console? Link to comment Share on other sites More sharing options...
Mattward Posted September 4, 2015 Author Share Posted September 4, 2015 I don't have a console, using Xcode, console.log("test"); does nothing. Link to comment Share on other sites More sharing options...
icp Posted September 4, 2015 Share Posted September 4, 2015 For your game you can try something more simple: this.toggleButton = this.game.add.sprite(0, 0, 'toggleButton'); this.toggleButton.frameName = 'onUp.png'; this.toggleButton.inputEnabled = true; this.toggleButton.events.onInputDown.add(downState, this); function downState () { this.toggleButton.frameName = 'onDown.png'; //add your callback } Link to comment Share on other sites More sharing options...
Mattward Posted September 4, 2015 Author Share Posted September 4, 2015 That doesn't seem to work either? Link to comment Share on other sites More sharing options...
icp Posted September 4, 2015 Share Posted September 4, 2015 I can't figure out the issue. Link to comment Share on other sites More sharing options...
Mattward Posted September 4, 2015 Author Share Posted September 4, 2015 Hmm :/ Mattward, Jessicaward25 and Joshloweiscum 3 Link to comment Share on other sites More sharing options...
Mattward Posted September 4, 2015 Author Share Posted September 4, 2015 The buttons work fine in a browser but when put onto an iOS Device or an Android Device they don't? I'm using the code you've specified. I really don't understand why? Link to comment Share on other sites More sharing options...
Mattward Posted October 23, 2015 Author Share Posted October 23, 2015 Test Link to comment Share on other sites More sharing options...
Joshloweiscum Posted October 23, 2015 Share Posted October 23, 2015 I'm having this problem with my bodger hap game. It isn't working and I'm getting really sad Dear dear dear... Jessicaward25 1 Link to comment Share on other sites More sharing options...
Mattward Posted October 23, 2015 Author Share Posted October 23, 2015 I know JoshLIC.. I have not found a solution to this problem as of yet. Please make sure you reply if you find one! Joshloweiscum 1 Link to comment Share on other sites More sharing options...
Joshloweiscum Posted October 23, 2015 Share Posted October 23, 2015 Hi mattward! Thanks for the reply! I have found another thread that may be helpful http://goo.gl/8jAQri Link to comment Share on other sites More sharing options...
Mattward Posted October 23, 2015 Author Share Posted October 23, 2015 Thank you JoshLIC.. I will check it out! Link to comment Share on other sites More sharing options...
Mattward Posted October 24, 2015 Author Share Posted October 24, 2015 Hang on a sec JoshLIC! This links to the exact same thread! OMG! You got me! lol Link to comment Share on other sites More sharing options...
Recommended Posts