rss
twitter

Saturday, February 21, 2009

Reload Flex Application By itself using NavigateToURL and Externalnterface Methods

With the simple logic we can allow a Flex swf reload by itself.
By Loading Application.application.url using UrlRequest in the same page using _self attribute we can get refresh/reload effect to the Flex swf file.

Here is lines that do the trick.

var urlRequest:URLRequest = new URLRequest(Application.application.url);
navigateToURL(urlRequest,"_self");


If you are using History management in your flex client or if you want to protect the state of #arguments availble in the URL when reloading swf then you can try

ExternalInterface.call("window.location.reload");

Because Reloading Application.application.url will clear out the # argument part.

Bookmark and Share

6 comments:

Anonymous,  June 14, 2009 at 5:00 AM  

ExternalInterface.call("window.location.reload");
will not work in IE

Haribabu August 4, 2009 at 12:19 AM  

a little change

ExternalInterface.call("function () {window.location.reload}");

will work

Anonymous,  May 18, 2010 at 7:40 AM  

Thanks for the post .. really thanks alot

hawkeye22 November 11, 2010 at 3:25 AM  

Thanks..

it must import mx.core.Application;

b(",)d

software test consulting November 29, 2010 at 2:17 AM  

I just got Chrome and Safari working, will it work on that? I tried it on Mozilla and it works great. 10x!

Post a Comment

Tech World

Label Cloud

Must Buy

  © Blogger templates by Ourblogtemplates.com updated with zenplate.com tips

Back to TOP