I want to call AS function from JS.
I have the following ActionScript 3 code:
package {
import flash.display.*;
import flash.events.*;
import flash.system.*;
import flash.external.ExternalInterface;
public class Main extends Sprite {
public function Main()
{
ExternalInterface.addCallback("PlaySound", PlaySound);
}
public function PlaySound():void
{
}
}
}
I need to call function PlaySound() from JavaScript. I try to do it in the following way:
function thisMovie(movieName) {
if (navigator.appName.indexOf("Microsoft") != -1) {
return window[movieName];
} else {
return document[movieName];
}
}
function m()
{
var obj=thisMovie("Main");
obj.PlaySound();
}
But obj has no method PlaySound() (obj is not null).
What's wrong?