How to refresh the application in Flex?

I designed a quiz application in Flex 4. Finally I want to reload my application (ie refresh the page in the browser). Finally, I will show in the alert Score. After that I want to reload the current application. How can I do this?
To refresh after clicking the alert:


xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:s="library://ns.adobe.com/flex/spark" xmlns:local="*"
>

import mx.controls.Alert;
import mx.core.FlexGlobals;
import mx.events.CloseEvent;
protected function refreshClicked(event:Event):void
{
Alert.show("Congratulations you won",
"Hooray!",
Alert.NO|Alert.YES, null, refreshFinish);
}
protected function refreshFinish(event:CloseEvent=null):void{
if(event == null){< br /> event = new CloseEvent("refreshFinish");
event.detail = Alert.YES;
}
if(event.detail == Alert.YES){
navigateToURL(new URLRequest(FlexGlobals.topLevelApplication.url), " _self");
}
}
]]>


You can remove the “NO” option by deleting it from the third parameter of Alert.show.

< /div>

I designed a quiz application in Flex 4. Finally I want to reload my application (i.e. refresh the page in the browser). Finally, I will display the score in the alert . Afterwards I want to reload the current application. How can I do this?

Refresh after clicking the alert:


xmlns:mx="library://ns. adobe.com/flex/mx"
xmlns:s="library://ns.adobe.com/flex/spark" xmlns:local="*"
>

import mx.controls.Alert;
import mx.core.FlexGlobals;
import mx.events.CloseEvent;
protected function refreshClicked(event:Event):void
{
Alert.show("Congratulations you won",
"Hooray!",
Alert.NO|Alert.YES, null, refreshFinish);
}
protected function refreshFinish(event:CloseEvent=null):void{
if(event == null){
event = new CloseEvent("refreshFinish") ;
event.detail = Alert.YES;< br /> }
if(event.detail == Alert.YES){
navigateToURL(new URLRequest(FlexGlobals.topLevelApplication.url), "_self");
}
}
]]>


You can delete the “NO” option by deleting it from the 3rd parameter of Alert.show.

Leave a Comment

Your email address will not be published.