ActionScript側のコード
CODE:
package
{
import flash.display.Sprite;
import flash.events.Event;
import flash.external.ExternalInterface;
import flash.text.TextField;
/**
* ...
* @author DefaultUser (Tools -> Custom Arguments...)
*/
public class Main extends Sprite
{
public var clickedNum:Boolean;
public function Main():void
{
if (stage) init();
else addEventListener(Event.ADDED_TO_STAGE, init);
}
private function init(e:Event = null):void
{
removeEventListener(Event.ADDED_TO_STAGE, init);
// entry point
clickedNum = ExternalInterface.available;
ExternalInterface.call("flaFunc", clickedNum);
}
}
}
HTML側のコード
CODE:
javascriptTest
function flaFunc(clickedNum){
alert(clickedNum);
}
var flashvars = {};
var params = {
menu: "false",
scale: "noScale"
};
swfobject.embedSWF("javascriptTest.swf", "altContent", "100%", "100%", "9.0.0", "expressInstall.swf", flashvars, params);
html, body { height:100%; }
body { margin:0; }
javascriptTest
Alternative content