How to refresh an application in Flex?

Santhosh Nayak picture Santhosh Nayak · Aug 2, 2011 · Viewed 7.2k times · Source

I have designed a quiz application in Flex 4. At the end I want to reload my application (that is refresh the page in the browser). At the end I will show score in an alert. After that I want to reload the current application. How can I do this?

Answer

Michiel Standaert picture Michiel Standaert · Aug 2, 2011

just navigate back to your website :)

navigateToURL(new URLRequest("linktoyourwebsite"));

to get the current page's url, you can use the following code:

import flash.external.ExternalInterface;

var pageURL:String = ExternalInterface.call('window.location.href.toString');

so your code then becomes:

var pageURL:String = ExternalInterface.call('window.location.href.toString');
navigateToURL(new URLRequest(pageURL));