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.
6 comments:
ExternalInterface.call("window.location.reload");
will not work in IE
a little change
ExternalInterface.call("function () {window.location.reload}");
will work
no it won't
Thanks for the post .. really thanks alot
Thanks..
it must import mx.core.Application;
b(",)d
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