js传值给flash

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <script src="jquery-1.7.2.min.js" type="text/javascript"></script>
    <script src="swfobject.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(function () {

            //初始化
            var flashvars = {};
            var params = { swliveconnect: "true", menu: "false", wmode: "transparent" };
            var attributes = { id: "flashContent", name: "flashContent", wmode: "transparent" };
            swfobject.embedSWF("e01001.swf", "flashContent", "800", "600", "9.0.0", "expressInstall.swf", flashvars, params, attributes, callbackFn);

        });

        //回调
        function callbackFn(status) {
             
            if (status.success) {
                var obj = status.ref;
                document.getElementById("allShow").onclick = function () {
                    if (obj && typeof obj.OperationType != "undefined") {
                        obj.OperationType(200);
                    }
                };
                document.getElementById("handShow").onclick = function () {
                    if (obj && typeof obj.OperationType != "undefined") {
                        obj.OperationType(100);
                    }
                };
            }
        };
    </script>
</head>
<body>
<div id="flash">
            <div id="flashContent" class="box">
            
            </div>
            </div>
            <input id="allShow" type="button" value="自动演示" />
            <input id="handShow" type="button" value="一步步演示" />
</body>
</html>

该demo只能放在网站运行服务器环境里才能有效果,比如IIS、vs默认的运行环境,直接打开html是没有效果的。

原文地址:https://www.cnblogs.com/hougelou/p/3668549.html