getObjectById
获取加载 Flash 元素。
swfobject.registerObject("myCom", "9.0.0", "swf/expressInstall.swf");
function AStoJSviaExternalInterface(str) {
document.getElementById("receive1").value = str;
};
function myCom_DoFSCommand(command, args) {
document.getElementById("receive2").value = args;
};
function AStoJSviaGetURL(str) {
document.getElementById("receive3").value = str;
};
window.onload = function() {
document.getElementById("but1").onclick = function() {
var obj = swfobject.getObjectById("myCom");
if (obj && typeof obj.JStoASviaExternalInterface != "undefined") {
obj.JStoASviaExternalInterface(document.getElementById("send").value);
}
};
document.getElementById("but2").onclick = function() {
var obj = swfobject.getObjectById("myCom");
if (obj && typeof obj.SetVariable != "undefined") {
obj.SetVariable("JStoASviaSetVariable", document.getElementById("send").value);
}
};
};