Search code examples
actionscript-3flash

Force browser to refresh page from flash game


I have flash game which communicate with server. If something goes wrong I want to show popup where will be said. Something is broken press ok button to refresh game.

btnHolder.addEventListener(MouseEvent.CLICK, refreshPage);

private function refreshPage(e:MouseEvent):void
{
...
}

How can I do this ? Is this even possible ? Or max I can do is just show popup with text "refresh your browser".


Solution

  • You could use ExternalInterface, like:

    ExternalInterface.call("document.location.reload", true);
    

    Could that work for you?