Flash JavaScript (Ajax) doesn't work in IE?
javascript:functionName(id);
in my browser it works.
In my Flash I use the JavaScript on a button with the following code:
getURL("javascript:functionName(id);");
I suppose that, that's a good way to use it?
But strangely enough nothing works in Flash, not even if I replace the code with alert('hello my friend');
(maybe he's not my friend?).
Could someone help me out and tell me what may be causing the problem?
Thanks in advance!You should be using AS ExternalInterface to communicate with JS, have a look on this: http://www.nelsond8.com/?p=515#more (here I'm using swfobject built in method swfobject.getObjectById, if you are not using swfObject replace this line with document.getElementById)
If you are using AS2, you could do something like this:
<script type="text/javascript">
function myFunction(id)
{
alert('hello my friend');
return 'hello my friend';
}
</script>
AS2:
import flash.external.*;
btn.onPress = function()
{
var jsReply:String = String(ExternalInterface.call("myFunction", "01"));
getURL("jsReply");
trace(jsReply);
}
And here is the externalInterface reference page for AS2: http://flash-reference.icod.de/
精彩评论