Tuesday, October 3, 2023
 Popular · Latest · Hot · Upcoming
rated 0 times [  80] [ 3]  / answers: 1 / hits: 18383  / 15 Years ago, tue, march 31, 2009, 12:00:00

I have a Javascript function that returns the innerHTML of a div. I am attempting to call this function from Actionscript and store the return value. I know that the Javascript function is being called because there is an alert that displays the return data, The data that is returned to Actionscript, however, is null. I am not sure what is causing this. Here is a code example of what I am attempting to do:

function JSFunc () {
var x = document.getElementById(myDiv);
return x.innerHTML;

import flash.external.*;
if (ExternalInterface.available) {
var retData:Object = ExternalInterface.call(JSFunc);
if(retData != null) {
textField.text = retData.toString();
} else {
textField.text = Returned Null;
} else {
textField.text = External Interface not available;

Like I said earlier, the alert shows up with the contents of the div but the text in the textfield is always Returned Null, meaning that the ExternalInterface is available. I should add that I can only test this in IE7 and IE8. Any advice on what to do would be much appreciated.

More From » apache-flex


The source of the problem that I have been having has to do the object tag that I was using to embed the flash movie. I was using a tag that followed this example http://www.w3schools.com/flash/flash_inhtml.asp, I changed it to match this example: http://kb.adobe.com/selfservice/viewContent.do?externalId=tn_4150 and then I made sure that I added id to the object and everything worked.

[#99776] Tuesday, March 24, 2009, 15 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.

Total Points: 548
Total Questions: 96
Total Answers: 96

Location: Lithuania
Member since Fri, Sep 4, 2020
3 Years ago
mackenzihannal questions
Fri, Apr 22, 22, 00:00, 1 Year ago
Sun, Feb 21, 21, 00:00, 3 Years ago
Sat, Oct 12, 19, 00:00, 4 Years ago
Thu, Aug 29, 19, 00:00, 4 Years ago