Greetings! This may or may not pertain to FlashPunk, but after some research I think it may. According to a few blogs and articles I’ve read, if you use navigateToURL in anything other than an mouse/keyboard event listener, that url will be blocked by a popup blocker. So I went ahead and tried it. I have a regular mouse_down event listener attached to the main stage, and whenever I click it takes me to a URL without the popup being blocked.
However, if I roll with FlashPunk’s system (Input.mousePressed), the popup is blocked. Basically I have a Button class:
override public function update():void
{
if (collidePoint(x, y, world.mouseX, world.mouseY))
{
if (Input.mousePressed) click();
}
super.update();
}
That is attached to all of my buttons in game by simply extending the class and overriding the click function, and of course when the mouse is pressed while hovering over one of these buttons (via hitbox) the click function is called. This poses a problem as browsers are apparently not detecting any sort of keypress/mouse press at this point and thus blocks the url from opening. Apparently, if the browser does not detect any sort of input from the user, then it blocks popups to prevent spamming popups, etc.
Does anyone know any way around this? I’ve read about using the ExternalInterface class but I’m not sure that’s the best way to go about it, and not sure it would work efficiently on everyone’s browsers.