首页 > 代码库 > js 调用 flash 方法

js 调用 flash 方法

js 调用 flash 方法

 

通过 objectswf.js 
调用actionscript中的方法.


演示:http://www.huiyi8.com/donghua/


<script type="text/javascript" language="javascript" src="http://www.mamicode.com/Scripts/swfobject.js"></script>
<script language="javascript">
    function load(){
        var swfVersionStr = "10.0.0";
        var params = {};
        params.quality = "high";        
        params.allowfullscreen = "false";
        params.allowscriptaccess = "always";    
        //params.wmode = "transparent";
        swfobject.embedSWF("flash/MainPage.swf", "FlashID", "597", "416", swfVersionStr,params);
    }
    //调用flash中的方法,"swfId"为html页中swf的id
    function setValue(o) {
         
        thisMovie("FlashID").getIds(o);
    }
     
    //搭建js与flash互通的环境 flash素材
    function thisMovie(movieName) {
        if (navigator.appName.indexOf("Microsoft") != -1) {
             
         return window[movieName];
        } else {
             
         return document[movieName];
        }
    }
</script>

 

js 调用 flash 方法