A question to Flash experts from a beginner: the flash object within a web page

前端 未结 3 976
慢半拍i
慢半拍i 2021-01-24 22:26

Here\'s my explanation of the question:

From JavaScript, you need to get a reference to the Flash Player object. There are two basic Flash Player versions that ru

相关标签:
3条回答
  • 2021-01-24 23:06

    Today I got a funny things. I use the common way to embed a flash in my blog.

    <object id="flashObject" width="290" height="100" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000">
        <param name="movie" value="javascriptcallflash.swf" />
        <param name="quality" value="high" />
        <param name="allowScriptAccess" value="always" />
        <embed name="flashObject" width="100%" height="100%" wmode="transparent" allowScriptAccess="always" width="290" height="100" type="application/x-shockwave-flash" src="javascriptcallflash.swf"/>
    </object>
    

    And I also use the common way to get the flash reference:

    <script type="text/javascript">
        function getFlashMovie(movieName) {   
            var isIE = navigator.appName.indexOf("Microsoft") != -1;
            return (isIE) ? window[movieName] : document[movieName];  
        }
        function CallFlashFun() {
            var textarea = document.getElementById("jsMsg")
            var flashObj = getFlashMovie("flashObject");
            flashObj.asFunction(textarea.value);
        }
    </script>
    

    The problem is that after I publish the post. It doesn't work. So I have try to replace window[movieName] to window.document[movieName]. Then it works. It's very weird.

    What's the different between window[movieName], document[movieName], and window.document[movieName]?

    0 讨论(0)
  • 2021-01-24 23:06

    swfobject.js still does this most reliably. So much so that it's been adopted by Adobe as the default embedding script.

    0 讨论(0)
  • 2021-01-24 23:15

    The answer is embedded in the question itself. IE uses object tags and hence SWF is a window object when embedded with object tags. Rest of the world uses embed tags and hence SWF is a property of the window.document for them.

    0 讨论(0)
提交回复
热议问题