3 Replies Latest reply on Feb 5, 2009 8:17 AM by matthew horn

    External Interface IE bug

    sk2910
      I used the embed tag in JavaScript to load the swf file.The swf file loads and the the JavaScript function gets called through the External Interface.call() method but the JavaScript function does not return the value to action script.It works fine in Firefox but it fails in IE 7.I need to use the embed tag only.
      Can anyone help with any info on this?
        • 1. Re: External Interface IE bug
          matthew horn Level 3
          The <object> tag is used by IE. The <embed> tag is used by Mozilla-based browsers. This is built into the browsers. If you only use an <embed> tag, then IE-based clients will have trouble loading your SWF.

          One possible solution is to use SWFObject 2 to do the embedding for you. It only requires that scripting is enabled on the browser.

          hth,
          matt horn
          flex docs
          • 2. Re: External Interface IE bug
            sk2910 Level 1
            Thanks for ur quick response

            I tried using the SWFObject v2.1 to load the swf in javascript.

            Here is the code in html:
            <html>
            <script type="text/javascript" src="Sample.js"></script>
            <body onload="str.initialize()">
            <div id="sample">
            </div>
            </body>
            </html>

            Code in javascript:
            var str = {
            temp:null
            };

            str.initialize =function (){
            document.write('<script type="text/javascript" src="swfobject.js"></script>');
            str.temp = document.getElementById('sample');
            swfobject.embedSWF("Sample.swf", "temp", "700", "700", "9.0.0");
            }

            I get a blank page in IE.On refreshing the page I get the following code in view source

            <script type="text/javascript" src="swfobject.js"></script><script id=__ie_ondomload defer=true src=//:></script>

            Can you please tell me what's wrong with the code?
            • 3. Re: External Interface IE bug
              matthew horn Level 3
              I think you need to pass the id and name params to swfobject's embedSWF() method. Plus, that "temp" I think should be "sample", so the content is added to the right place.

              Here's an example that shows a full blown wrapper that works in IE and Firefox.

              matt horn
              flex docs