redrory Posted October 30, 2014 Share Posted October 30, 2014 (edited) Hey, So I'm customizing the Flying Dog game, on death; When the score and restart screen appears, I have added additional buttons, this work perfectly on desktop browsers but not on mobile browsers (iPhone, Andriod and iPad). I followed how the restartButton was added to add the others, however it's not recognized on mobile.I added the others like this -var moreBut = new game.Sprite('media/info.png', -100, 275);moreBut.interactive = true;box.addChild(moreBut);moreBut.click = function() { window.location.href = "http://awesomesuace.com"; }On web, I'm taken to the link no problem, but on mobile it doesn't recognize the click Edited October 30, 2014 by redrory Quote Link to comment Share on other sites More sharing options...
Phempt Posted October 30, 2014 Share Posted October 30, 2014 Change this:backBut.click = function() { window.location.href = "http://awesomesuace.com"; }with:backBut.touchstart = backBut.click = function() { window.location.href = "http://awesomesuace.com"; } Quote Link to comment Share on other sites More sharing options...
redrory Posted October 30, 2014 Author Share Posted October 30, 2014 Hey Phempt, Thanks for your reply, I've tried above, and it's still not recognizing the click when using Safari on iPhone or any other mobile browsers Quote Link to comment Share on other sites More sharing options...
Phempt Posted October 30, 2014 Share Posted October 30, 2014 ehm I've just seen, that you declared the button variable with "moreBut", but the touch function use: backBut try with:moreBut.touchstart = moreBut.click = function() { window.location.href = "http://awesomesuace.com"; } Quote Link to comment Share on other sites More sharing options...
redrory Posted October 30, 2014 Author Share Posted October 30, 2014 Hey, That was actually a typo that I made when adding code to this forum, as I also have a moreBut button. I've updated the code to reflect me calling the correct button. Still not working on moble, the following works perfectly on Web even with the touchstart, just not on mobile moreBut.touchstart = moreBut.click = function() { window.location.href = "http://awesomesuace.com"; } Quote Link to comment Share on other sites More sharing options...
Phempt Posted October 30, 2014 Share Posted October 30, 2014 Use:window.open("http://www.w3schools.com");instead of "window.location.href=..." use "console.log" or "alert()" to debug it and check if touch is detected Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.