I created an AS3 script with a function
public function sayHello():String
{
return "Hello";
}
I have also registered the callback as follows
ExternalInterface.addCallback("sayHello", sayHello);
In my javascript, I have embedded the SWF file as follows
<script type="text/javascript" src="swfobject.js"></script>
<script type="text/javascript">
swfobject.embedSWF("HelloWorld.swf", "HelloWorld", "1", "1", "9.0.0");
</script>
But when I try to call the sayHello method as follows
document.getElementById("HelloWorld").sayHello();
I am getting Uncaught TypeError: Cannot call method 'sayHello' of undefined
Any help will be appreciated!