7 Replies Latest reply on May 28, 2008 1:41 PM by kglad

    Can't get External API to work in IE7

    atpark333
      I'm trying to get a Flash Ad to call a Javascript function in an Ajax page. I'm using ActionScript 2.0 ExternalAPI to call a function in the page that adds an item to a shopping list. I can get this to work in all browsers except IE7. It even works in IE7 when I put this Ad alone in a basic html page, but as soon as I put it in an Ajax page it does not call the function in IE7.
      I appreciate any help or suggestions
        • 1. Re: Can't get External API to work in IE7
          kglad Adobe Community Professional & MVP
          i haven't had any problems using externalinterface with ajax. in particular, everything works in ie7.
          • 2. Re: Can't get External API to work in IE7
            atpark333 Level 1
            Thanks for the input. I'm not familiar with Ajax so it helps to know if there are any known issues. I assumed it was an Ajax issue because the same ad works in a non-ajax web page that uses frames. The ad is being served through DoubleClick, here is the rich media code that embeds the Flash Ad:

            <!-- This is DART's Rich Media code template. It basically checks user's flash version and browser, embeds flash creative in page or serves fall back image if user does not have the required version of flash player. -->

            <SCRIPT LANGUAGE=JavaScript>
            <!--
            var dcswf = "%h/1146572/HormelFlash.swf";
            var dcgif = "%h/1146572/HormelFallBack.jpg";
            var advurl = "%c%u";
            var dcadvurl = escape(advurl);
            var dcminversion = 8;
            var dcmaxversion = 9;
            var plugin = false;
            var dccreativewidth = "300";
            var dccreativeheight = "250";
            var dcwmode = "transparent";
            var dcbgcolor = "FFFFFF";
            var dcallowscriptaccess = "always";

            if (((navigator.appName == "Netscape") && (navigator.userAgent.indexOf("Mozilla") != -1) && (parseFloat(navigator.appVersion) >= 4) && (navigator.javaEnabled()) && navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"] && navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin)) {
            var plugname=navigator.plugins['Shockwave Flash'].description;var plugsub=plugname.substring(plugname.indexOf("."),-1); var plugsubstr=plugsub.substr(-1)
            if( plugsubstr >= dcminversion) { plugin = true;}
            }
            else if (navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0 && (navigator.userAgent.indexOf("Opera")<0) && (navigator.userAgent.indexOf("Windows 95")>=0 || navigator.userAgent.indexOf("Windows 98")>=0 || navigator.userAgent.indexOf("Windows NT")>=0) && document.all)
            {
            document.write('<script language=VBScript>' + '\n' +
            'dcmaxversion = '+dcmaxversion + '\n' +
            'dcminversion = '+dcminversion + '\n' +
            'Do' + '\n' +
            'On Error Resume Next' + '\n' +
            'plugin = (IsObject(CreateObject(\"ShockwaveFlash.ShockwaveFlash.\" & dcmaxversion & \"\")))' + '\n' +
            'If plugin = true Then Exit Do' + '\n' +
            'dcmaxversion = dcmaxversion - 1' + '\n' +
            'Loop While dcmaxversion >= dcminversion' + '\n' +
            '<\/script>');
            }
            if ( plugin ) {
            adcode = '<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+
            ' ID="FLASH_ID" WIDTH="'+ dccreativewidth +'" HEIGHT="'+ dccreativeheight +'">'+
            '<PARAM NAME=movie VALUE="' + dcswf + '?clickTag='+ dcadvurl +'"><PARAM NAME=quality VALUE=high><PARAM NAME=bgcolor VALUE=#'+ dcbgcolor +'><PARAM NAME=wmode VALUE='+ dcwmode +'><PARAM NAME="AllowScriptAccess" VALUE="'+dcallowscriptaccess+'">'+
            '<EMBED src="' + dcswf + '?clickTag='+ dcadvurl +'" quality=high wmode='+dcwmode+
            ' swLiveConnect=TRUE WIDTH="'+ dccreativewidth +'" HEIGHT="'+ dccreativeheight +'" bgcolor=#'+ dcbgcolor+
            ' TYPE="application/x-shockwave-flash" AllowScriptAccess="'+dcallowscriptaccess+'"></EMBED></OBJECT>';
            if(('%eenv!'!="j")&&(typeof dclkFlashWrite!="undefined")){dclkFlashWrite(adcode);}else{document.write(adcode);}
            } else {
            document.write('<A TARGET="%t" HREF="%c%u"><IMG SRC="' + dcgif + '" alt="" BORDER=0></A>');
            }
            //-->
            </SCRIPT><NOSCRIPT><A TARGET="%t" HREF="%c%u"><IMG SRC="%h/1146572/HormelFallBack.jpg" alt="" BORDER=0></A></NOSCRIPT>

            the ad can be viewed here: http://ads.beta.groceryshopping.net/Shop/WeeklyAd.aspx
            • 3. Re: Can't get External API to work in IE7
              kglad Adobe Community Professional & MVP
              you should check if there's a known issue with that code and ie7.
              • 4. Re: Can't get External API to work in IE7
                atpark333 Level 1
                I think I found the problem the Flash ad is within a <form> element. The ID attribute of the <OBJECT> element was throwing an error (undefined object) in IE7.

                I found this work around:
                http://www.teratechnologies.net/stevekamerman/index.php?entry=entry070101-033933

                • 6. Re: Can't get External API to work in IE7
                  atpark333 Level 1
                  Unfortunately this did not solve the issue. There isn't a JavaScript error anymore but the flash Ad does not call the JS function when clicked. I added this code after the <OBJECT><EMBED> elements:

                  <script type="text/javascript">window.FLASH_AD = document.forms[0].FLASH_AD;</script>

                  It still works fine in FireFox, Safari, and IE6.
                  • 7. Re: Can't get External API to work in IE7
                    kglad Adobe Community Professional & MVP
                    a swf embedded within a form element causes a known issue with ie and externalinterface. use google to search for work-arounds.