http://storehouse.sakura.ne.jp/as/ex_if.html
Flashのバージョンごとの普及具合がいまいち不明…
import flash.external.ExternalInterface; class ExIf { static function main() { ExternalInterface.addCallback('fs_func', null, function(msg) { ExternalInterface.call('js_func', msg); }); }; }
~$ mtasc -version 8 -swf ex_if.swf -main ex_if.as -header 0:0:0
<html> <head> <script type="text/javascript"> function $M(movieName) { return (navigator.appName.indexOf("Microsoft") != -1) ? window[movieName] : document[movieName]; } function js_func(msg) { alert(msg); } </script> </head> <body> <object id="myflash" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="0" height="0"> <param NAME="movie" VALUE="ex_if.swf"> <embed name="myflash" src="ex_if.swf" width="0" height="0"></embed> </object> <input type="button" value="Click" onclick="$M('myflash').fs_func('call from javascript.');"> </body> </html>