Hi, I have an issue enabling clicks to open external links to social media websites on new browser windows (iOS Safari browser on mobile phones).
Prior to this, I have consulted online threads similar to my issue on this very same website.
(External links Phaser 3 iOS) However, using the code that was provided from that thread causes the various SetInteractive()
game objects to not just open their respective links, but also other links that were clicked before.
someInteractiveButton.on('pointerdown', (pointer, targets) => {
this.input.addUpCallback( () => {
window.open("https://somewebsite.com, "_blank");
}, true);
});
Should I still use addUpCallback
onto the three different Interactive game objects, if I needed to let each button open their respective Social Media links only once?
What are the necessary modifications I must make to the blocks on create()
method?
Sample Social Media button setup()
preload() {
this.load.image("socialmedia_twitter", "assets/img/socialmedia-twitter.png");
}
...
create() {
var socialmedia_tweet = this.add.image(666, 700, "socialmedia_twitter");
...
socialmedia_tweet.on('pointerup', (pointer, targets) => {
var tweetbegin = "http://twitter.com/intent/tweet?text=";
var tweettxt = "Lorem ipsum! Please support me at: https://somewebsite.com";
var finaltweet = tweetbegin + encodeURIComponent(tweettxt);
window.open(finaltweet, "_blank");
});
}
The reason why I am still using v3.15.1 instead of the newest 3.20 release, is due to my experience that using the newest version causes my character tilemap object to have a bug - it jitters left and right eratically. Additionally, I am on an extremely tight schedule, I don’t believe that I have the time to fully rewrite my current project’s code from scratch. Any help is appreciated!