July 08, 2009

Refresh Flex page using Javascript function in AS3

Hi,
In Flex once the values get updated we need to refresh the felx content dynamically. Here i did one example for refresh the flex page by calling the javascript function when click the button in flex application. Its very simple way to refresh the flex page whenever you wants by using the following javascript function calls.

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:Script>
<![CDATA[
import flash.net.navigateToURL;
private function onRefresh():void
{
var ref:URLRequest = new URLRequest("javascript:location.reload(true)");
navigateToURL(ref,"_self");
}
]]>
</mx:Script>
<mx:Button label="Refresh" click="onRefresh()"/>
</mx:Application>

2 comments:

  1. After going through lot of sites, your code snippet was truly helpful. Thanks and do keep posted on such small little issues which takes up lot of times.
    ~Abdul

    ReplyDelete
  2. Hi Every one,

    In my project I have so many workspace i want to refresh a particular workspace. Can any one help me

    ReplyDelete