2
votes

I am looking for a way to dynamically set the window title for a flex application in Internet Explorer. The most best way to do this is to call javascript from actionscript to set the window title via an "ExternalInterface."

ExternalInterface.call("eval(window.document.title = 'New Title')"); ExternalInterface.call("alert", "Hello ExternalInterface");

This works fine in browsers other than IE, and it even works in IE when accessing the flex application's swf file through an html wrapper.

ttp://localhost:8080/ChangeTitle/ChangeTitle.html

However, I need to access the .swf directly from the browser.. ttp://localhost:8080/ChangeTitle/ChangeTitle.swf

This causes the External interface call to change the window title to not work, but the alert still shows.

So the question is... why don't I just use the html wrapper? ... The answer: because the project is set up specifically to avoid using the html wrapper.

This is related to a known IE bug - http://bugs.adobe.com/jira/browse/FP-240

If anyone could suggest a work-around for this issue it would be greatly appreciated.

Thanks

1
What do you mean with html wrapper? - RIAstar

1 Answers

5
votes

Don't use ExternalInterface for this; use the BrowserManager class. You can first initialize it with a title:

var browser:IBrowserManager = BrowserManager.getInstance();
browser.init("", "my title");

Later you can adjust the title later on:

browser.setTitle("my new title");

I have several applications that use this and work perfectly in IE (though I haven't tested IE6).
More info on this topic: http://help.adobe.com/en_US/flex/using/WS2db454920e96a9e51e63e3d11c0bf64e50-7ff4.html