So, this code splits the screen into two frames:
Javascript:A14nH=location.href;L3f7="http://www.google.com";R1Gh7="http://www.google.com";if(L3f7&&R1Gh7){Fr4Q='<frameset%20cols=\'*,*\'>\n<frame%20src=\''+L3f7+'\'/>';Fr4Q+='<frame%20src=\''+R1Gh7+'\'/>\n';Fr4Q+='</frameset>';with(document){write(Fr4Q);void(close())}}else{void(null)}
I need to run this code from a flex application and what I am doing is:
var jsFunc:String = "function () { location.href=\"javascript:A14nH=location.href; L3f7=\"http://www.google.com\";R1Gh7=\"http://www.google.com\";if(L3f7&&R1Gh7){Fr4Q=\"<frameset%20cols=\"*,*\">\n<frame%20src=\"\"+L3f7+\"\"/>\";Fr4Q+=\"<frame%20src=\"\"+R1Gh7+\"\"/>\n\";Fr4Q+=\"</frameset>\";with(document){write(Fr4Q);void(close())}}else{void(null)}\"}";
var divExists:Boolean = ExternalInterface.call(jsFunc);
Can someone tell me what’s wrong?
(Btw, if you change var jsFunc:String = "function () { location.href='http://www.google.com' }"; the page does take you to Google)
Make sure your “allowNetworking” parameter of the object and embed tags of Flash is set to true. With that parameter, the whole ExternalInterface package becomes severely limited.
Also, it may be a better idea to store the javascript along with the HTML. Then, from AS3, you can call the js function using
ExternalInterface.IN ActionScript:
ExternalInterface.call(myJavascriptFunc)will callmyJavascriptFuncif it is loaded in the same page as the Flash application.