Closed nicoulaj closed 13 years ago
Updated by Julien.N...@gmail.com on 2010-05-14T15:49:35
Original ticket set status to Acknowledged (we converted to open)
Updated by Julien.N...@gmail.com on 2010-05-14T16:33:48
Issue 3 has been merged into this issue.
Updated by Julien.N...@gmail.com on 2010-05-14T17:04:23
We need to fix this before upgrading to Flex 4.
Removed label Priority-Medium Added label Priority-High
Updated by ryan2...@gmail.com on 2010-05-18T15:05:15
I have found that I have to define JavaScript functions that I want to call inside the iframe source page as attached specifically to the document object (as this is how the callIFrameFunction code expects to find them)
So for your example above, try changing the JS function to be declared like this:
document.clickMe = function () { alert('1'); }
Updated by Julien.N...@gmail.com on 2010-05-19T20:00:21
OK, I added an example for callIFrameFunction(): http://code.google.com/p/flex- iframe/source/browse/#svn/trunk/examples/CallIFrameFunction
As Ryan said, you have to declare the function this way:
document.myFunction = function () { // ... }
Removed label Priority-High Added label Priority-Medium Original ticket set status to Accepted (we converted to open) Title changed from 'callIFrameFunction() does not work with all ways to declare Javascript functions' to 'callIFrameFunction() does not work with all ways to declare Javascript functions'
Updated by end...@gmail.com on 2010-10-15T11:50:57
I have copy the example and test it.
The parameter function doesn' work on IE8, but the other two works fine. On Firefox works but when the alert appears, Firefox freeze. Everything works fine on Chrome.
anyone can help me to solve it?
Updated by ernesto....@gmail.com on 2010-11-13T05:08:08
The problem is that you are trying to target the document while your methods are on the window object. Try this code instead:
public static var INSERT_FUNCTION_CALLIFRAMEFUNCTION:String = "document.insertScript = function ()" + "{ " + "if (document." + FUNCTION_CALLIFRAMEFUNCTION + "==null)" + "{" + FUNCTION_CALLIFRAMEFUNCTION + " = function (iframeID, functionName, args)" + "{" + "var iframeRef=document.getElementById(iframeID);" + "var iframeWin;" + "if (iframeRef.contentWindow) {" + "iframeWin = iframeRef.contentWindow;" + "} else if (iframeRef.contentDocument) {" + "iframeWin = iframeRef.contentDocument.window;" + "} else if (iframeRef.window) {" + "iframeWin = iframeRef.windwo;" + "}" + "if (iframeWin.wrappedJSObject != undefined) {" + "iframeWin = iframeDoc.wrappedJSObject;" + "}" + "return iframeWinfunctionName;" + "}" + "}" + "}";
Updated by ivan.str...@gmail.com on 2011-03-08T15:04:50
Last post works like a charm. Thanks! Note that the proposed code has a typo, “iframeWin = iframeRef.windwo;”, should be “iframeWin = iframeRef.window;”.
Cheers, Ivan
Originally filed by niketkan...@gmail.com on 2010-02-23T07:01:35
I am unable to get the callIFrameFunction method working. Below is my code snippet. Any help would be mich appreciated:-
I am calling a js function defined in my iframe source page:-
frame1.callIFrameFunction("clickMe");
In the html page, I have added the function:-
function clickMe() { alert('1'); }
But i dont get the alert. Please can anyone advice where I am going wrong.
Thanks