This content has been marked as final. Show 5 replies
Hey - try this instead. This works in both IE and Firefox...
var flashobject = document.getElementById("myflashmovie");
(make sure you put id="myflashmovie" in both the <object> and <embed> params).
Here's something I use while testing JS/Flash interaction. In your Flash code, insert
ExternalInterface.call("alert", "JS has called a Flash function");
(or whatever useful message you want).
Then, when your Flash function has successfully been called, you'll get a JS alert.
But try using getElementById first and see if that works for you.
kglad - there doesn't need to be a sendTextToFlash JS function. "sendTextToFlash" is made into an object method as soon as it's made accessible via ExternalInterface.addCallback within the Flash file.
Their idea is along the right lines, trying to invoke this kind of thing...
I think the problem is that the flashobject isn't being referenced properly.
thanks liquidleaf your solution worked perfectly. but only on IE and Safari, but there still nothing happens when you try it on firefox, calling JS from AS works but not the other way around