6 Replies Latest reply on Nov 27, 2009 7:37 AM by veesyn

    problem while loading swf in IE

    veesyn Level 1

      Hi

       

      i have my swf getting loaded in Firefox, i dont see my swf getting loaded in IE.

       

      Here is how i do it.

       

      var so;

      function loadSWF() {
          so = new SWFObject("/asdf/xxx.swf", "so", "100%", "100%", "9", "#ffffff");
          so.addVariable("xmlServiceDataLocation", "/cgi-bin/apps/xml/xmlFile");
          so.addVariable("xmlServiceDataType", "growth");
          so.addParam("quality", "high");
          so.addParam("scale", "noscale");
          so.addParam("wmode","transparent");
          so.write("mydiv");
         
      }  

       

      <div id="mydiv"></div>

       

      Is there anything am missing in this code?

        • 1. Re: problem while loading swf in IE
          choisington

          OK well I had the same problem.


          This is how I do it:

           

           

          <script src="javascript/AC_OETags.js" language="javascript"></script>

           

           

           

          <style>
          body { margin: 0px}
          </style>
          <script language="JavaScript" type="text/javascript">
          <!--
          // -----------------------------------------------------------------------------
          // Globals
          // Major version of Flash required
          var requiredMajorVersion = 9;
          // Minor version of Flash required
          var requiredMinorVersion = 0;
          // Minor version of Flash required
          var requiredRevision = 124;
          // -----------------------------------------------------------------------------
          // -->
          </script>

           

           

           

          <script language="JavaScript" type="text/javascript">
          <!--
          // Version check for the Flash Player that has the ability to start Player Product Install (6.0r65)
          var hasProductInstall = DetectFlashVer(6, 0, 65);

           

          // Version check based upon the values defined in globals
          var hasRequestedVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);

           

          if ( hasProductInstall && !hasRequestedVersion ) {
              // DO NOT MODIFY THE FOLLOWING FOUR LINES
              // Location visited after installation is complete if installation is required
              var MMPlayerType = (isIE == true) ? "ActiveX" : "PlugIn";
              var MMredirectURL = window.location;
              document.title = document.title.slice(0, 47) + " - Flash Player Installation";
              var MMdoctitle = document.title;

           

              AC_FL_RunContent(
                  "src", "playerProductInstall",
                  "FlashVars", "MMredirectURL="+MMredirectURL+'&MMplayerType='+MMPlayerType+'&MMdoctitle='+MMdoctitle+"" ,
                  "width", "460",
                  "height", "700",
                  "align", "middle",
                  "id", "purchaseForm",
                  "quality", "high",
                  "bgcolor", "#869ca7",
                  "name", "purchaseForm",
                  "allowScriptAccess","sameDomain",
                  "type", "application/x-shockwave-flash",
                  "pluginspage", "http://www.adobe.com/go/getflashplayer"
              );
          } else if (hasRequestedVersion) {
              // if we've detected an acceptable version
              // embed the Flash Content SWF when all tests are passed
              AC_FL_RunContent(
                      "src", "purchaseForm",
                      "width", "460",
                      "height", "700",
                      "align", "middle",
                      "id", "purchaseForm",
                      "quality", "high",
                      "bgcolor", "#869ca7",
                      "name", "purchaseForm",
                      "allowScriptAccess","sameDomain",
                      "type", "application/x-shockwave-flash",
                      "pluginspage", "http://www.adobe.com/go/getflashplayer"
              );
            } else {  // flash is too old or we can't detect the plugin
              var alternateContent = 'Alternate HTML content should be placed here. '
                + 'This content requires the Adobe Flash Player. '
                 + '<a href=http://www.adobe.com/go/getflash/>Get Flash</a>';
              document.write(alternateContent);  // insert non-flash content
            }
          // -->
          </script>
          <noscript>
                <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
                      id="homerForms" width="100%" height="100%"
                      codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab">
                      <param name="movie" value="purchaseForm.swf" />
                      <param name="quality" value="high" />
                      <param name="bgcolor" value="#869ca7" />
                      <param name="allowScriptAccess" value="sameDomain" />
                      <embed src="purchaseForm.swf" quality="high" bgcolor="#869ca7"
                          wmode="transparent"
                          width="460" height="700" name="signUpForm" align="middle"
                          play="true"
                          loop="false"
                          quality="high"
                          allowScriptAccess="sameDomain"
                          type="application/x-shockwave-flash"
                          pluginspage="http://www.adobe.com/go/getflashplayer">
                      </embed>
              </object>
              </noscript>

           

           

           

           

           


          The AC_OETags.js file should contain this code:

           

           

           

           

           

           

           

           

           

           

           

            <script src="javascript/AC_OETags.js" language="javascript"></script>

           

           

           

          <style>
          body { margin: 0px}
          </style>
          <script language="JavaScript" type="text/javascript">
          <!--
          // -----------------------------------------------------------------------------
          // Globals
          // Major version of Flash required
          var requiredMajorVersion = 9;
          // Minor version of Flash required
          var requiredMinorVersion = 0;
          // Minor version of Flash required
          var requiredRevision = 124;
          // -----------------------------------------------------------------------------
          // -->
          </script>

           

           

           

          <script language="JavaScript" type="text/javascript">
          <!--
          // Version check for the Flash Player that has the ability to start Player Product Install (6.0r65)
          var hasProductInstall = DetectFlashVer(6, 0, 65);

           

          // Version check based upon the values defined in globals
          var hasRequestedVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);

           

          if ( hasProductInstall && !hasRequestedVersion ) {
              // DO NOT MODIFY THE FOLLOWING FOUR LINES
              // Location visited after installation is complete if installation is required
              var MMPlayerType = (isIE == true) ? "ActiveX" : "PlugIn";
              var MMredirectURL = window.location;
              document.title = document.title.slice(0, 47) + " - Flash Player Installation";
              var MMdoctitle = document.title;

           

              AC_FL_RunContent(
                  "src", "playerProductInstall",
                  "FlashVars", "MMredirectURL="+MMredirectURL+'&MMplayerType='+MMPlayerType+'&MMdoctitle='+MMdoctitle+"" ,
                  "width", "460",
                  "height", "700",
                  "align", "middle",
                  "id", "purchaseForm",
                  "quality", "high",
                  "bgcolor", "#869ca7",
                  "name", "purchaseForm",
                  "allowScriptAccess","sameDomain",
                  "type", "application/x-shockwave-flash",
                  "pluginspage", "http://www.adobe.com/go/getflashplayer"
              );
          } else if (hasRequestedVersion) {
              // if we've detected an acceptable version
              // embed the Flash Content SWF when all tests are passed
              AC_FL_RunContent(
                      "src", "purchaseForm",
                      "width", "460",
                      "height", "700",
                      "align", "middle",
                      "id", "purchaseForm",
                      "quality", "high",
                      "bgcolor", "#869ca7",
                      "name", "purchaseForm",
                      "allowScriptAccess","sameDomain",
                      "type", "application/x-shockwave-flash",
                      "pluginspage", "http://www.adobe.com/go/getflashplayer"
              );
            } else {  // flash is too old or we can't detect the plugin
              var alternateContent = 'Alternate HTML content should be placed here. '
                + 'This content requires the Adobe Flash Player. '
                 + '<a href=http://www.adobe.com/go/getflash/>Get Flash</a>';
              document.write(alternateContent);  // insert non-flash content
            }
          // -->
          </script>
          <noscript>
                <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
                      id="homerForms" width="100%" height="100%"
                      codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab">
                      <param name="movie" value="purchaseForm.swf" />
                      <param name="quality" value="high" />
                      <param name="bgcolor" value="#869ca7" />
                      <param name="allowScriptAccess" value="sameDomain" />
                      <embed src="purchaseForm.swf" quality="high" bgcolor="#869ca7"
                          wmode="transparent"
                          width="460" height="700" name="signUpForm" align="middle"
                          play="true"
                          loop="false"
                          quality="high"
                          allowScriptAccess="sameDomain"
                          type="application/x-shockwave-flash"
                          pluginspage="http://www.adobe.com/go/getflashplayer">
                      </embed>
              </object>
              </noscript>

          • 2. Re: problem while loading swf in IE
            veesyn Level 1

            Hi

            Still have it not working

             

            This is how am doing it.

             

            HTML PAGE

             

            <script type="text/javascript" src="AC_OETags.js"></script>

             

            <script language="JavaScript" type="text/javascript">
            <!--
            // -----------------------------------------------------------------------------
            // Globals
            // Major version of Flash required
            var requiredMajorVersion = 9;
            // Minor version of Flash required
            var requiredMinorVersion = 0;
            // Minor version of Flash required
            var requiredRevision = 124;
            // -----------------------------------------------------------------------------
            // -->
            </script>

             

            <script language="JavaScript" type="text/javascript" src="AC_OETags.js">
            <!--
            // Version check for the Flash Player that has the ability to start Player Product Install (6.0r65)
            var hasProductInstall = DetectFlashVer(6, 0, 65);

             

            // Version check based upon the values defined in globals
            var hasRequestedVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);

             

            if ( hasProductInstall && !hasRequestedVersion ) {
                // DO NOT MODIFY THE FOLLOWING FOUR LINES
                // Location visited after installation is complete if installation is required
                var MMPlayerType = (isIE == true) ? "ActiveX" : "PlugIn";
                var MMredirectURL = window.location;
                document.title = document.title.slice(0, 47) + " - Flash Player Installation";
                var MMdoctitle = document.title;

             

                AC_FL_RunContent(
                    "src", "playerProductInstall",
                    "FlashVars", "MMredirectURL="+MMredirectURL+'&MMplayerType='+MMPlayerType+'&MMdoctitle='+MMdoctitle+"" ,
                    "width", "100%",
                    "height", "100%",
                    "align", "middle",
                    "id", "PerfDynaChart",
                    "quality", "high",
                    "bgcolor", "#ffffff",
                    "name", "PerfDynaChart",
                    "allowScriptAccess","sameDomain",
                    "type", "application/x-shockwave-flash",
                    "pluginspage", "http://www.adobe.com/go/getflashplayer"
                );
            } else if (hasRequestedVersion) {
                // if we've detected an acceptable version
                // embed the Flash Content SWF when all tests are passed
                AC_FL_RunContent(
                        "src", "/amer/swfs/performanceChart",
                        "width", "100%",
                        "height", "100%",
                        "align", "middle",
                        "id", "PerfDynaChart",
                        "quality", "high",
                        "bgcolor", "#ffffff",
                        "name", "PerfDynaChart",
                        "allowScriptAccess","sameDomain",
                        "type", "application/x-shockwave-flash",
                        "pluginspage", "http://www.adobe.com/go/getflashplayer"
                );
              } else {  // flash is too old or we can't detect the plugin
                var alternateContent = 'Alternate HTML content should be placed here. '
                  + 'This content requires the Adobe Flash Player. '
                   + '<a href=http://www.adobe.com/go/getflash/>Get Flash</a>';
                document.write(alternateContent);  // insert non-flash content
              }
            // -->
            </script>

             

            <div id="perfChartContainer">

             

              <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
                        id="so" width="100%" height="100%"
                        codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab">
                        <param name="movie" value="/amer/swfs/performanceChart/PerfDynaChart.swf" />
                        <param name="quality" value="high" />
                        <param name="bgcolor" value="#ffffff" />
                        <param name="allowScriptAccess" value="sameDomain" />
                        <param name='flashVars' value='xmlServiceDataLocation=/cgi-bin/apps/xml/AGPDisplayChart&xmlServiceDataType=assetg rowth'/>

             

                    <embed src="/amer/swfs/performanceChart/PerfDynaChart.swf" quality="high" bgcolor="#ffffff"
                            wmode="transparent"
                            width="100%" height="100%" name="signUpForm" align="middle"
                            play="true"
                            loop="false"
                            quality="high"
                            allowScriptAccess="sameDomain"
                            type="application/x-shockwave-flash"
                            pluginspage="http://www.adobe.com/go/getflashplayer">
                            flashVars='xmlServiceDataLocation=/cgi-bin/apps/xml/AGPDisplayChart&xmlServiceDataType=as setgrowth'
                        </embed>
                </object>

             

            </div>

             

            This code is working fine with Firefox,

            If i use  the <noscript> tag i cant see the flash file in Firefox also. but nothing special hapening in IE.

             

            any idea ?

            • 3. Re: problem while loading swf in IE
              choisington Level 1

              Yea, when I figured this out, what I did was run the application from Flex Builder in IE then I viewed the source on that page. I came up with the code I had. Make sure you go through and change all the file names, etc. But I got it to work for all my apps in IE.

               

              I also tried it with the noscript tags removed and it did not work. I dont know why but this is what worked.

               

              Just looking through your post, you missed some of the names that I had. My app was purchaseForm. Make sure you get them all .

              • 4. Re: problem while loading swf in IE
                Dheeraj.Rajoriya

                i am using like this in in my JSP page :

                 

                <div>

                <!-- saved from url=(0013)about:internet -->

                <!-- amstock script-->

                  <script type="text/javascript" src="amstock/swfobject.js"></script>

                <div id="flashcontent">

                <strong>You need to upgrade your Flash Player</strong>

                </div>

                 

                <script type="text/javascript">

                // <![CDATA[

                var so = new SWFObject("amstock/amstock.swf", "amstock", "800", "500", "8", "#FFFFFF");

                so.addVariable("path", "amstock/");

                so.addVariable("settings_file", encodeURIComponent("amstock/amstock_settings.xml"));

                so.addVariable("preloader_color", "#999999");

                so.write("flashcontent");

                // ]]>

                </script>

                <!-- end of amstock script -->

                </div>

                Thanks,
                Dheeraj.

                1 person found this helpful
                • 5. Re: problem while loading swf in IE
                  choisington Level 1

                  Sorry, but I don't know enough to know what you are not missing. I just had the exact same problem and was able to figure it out with that code. I would try using my code exactly but just replace my file names with yours.

                   

                  I had it working in every browser including IE.

                  1 person found this helpful
                  • 6. Re: problem while loading swf in IE
                    veesyn Level 1

                    I had some js library functions which i moved to different js file and it all worked fine in IE and all browsers. the world s worst browser IE !