How can I call a JavaScript function embedded inside an html page using flex?
I know there are ways to invoke javascript inside the html wrapper template for the flex application using ExternalInterface, but is it possible to refe开发者_如何学Gorence an external html page?
JavaScript, generally, operates on the page that is loaded/renderered in a browser. It sounds like you want to run a JavaScript function on a page that isn't currently loaded/renderered in the browser. This would not be possible.
You might be able to do something with an embedded/hidden iframe in the html wrapper that loads your external page hidden from view. Then ExternalInterface should be able to access the HTML Wrapper which can access the iFrame.
If you know the name of the other page/tab, use ExternalInterface
to call a function on your current page which then calls a function on a "sister" page/tab. If the other page is not yours, or is on a different domain, you may be out of luck :(
How to call a function in separate named window:
new_window = window.open("page2.php", "window2", "height=120");
new_window.test();
Sample taken from: http://www.ozzu.com/programming-forum/call-javascript-function-from-another-window-t54343.html
i think its not possible to reference an external html page. you call function in AS3
ExternalInterface.call("MyFun");
in html wrapper file of flex within javascript you have to define function MyFun
function MyFun()
{
............
..........
}
精彩评论