10 Replies Latest reply on Apr 21, 2010 12:52 PM by mentlity

    Embedding Flash in an .aspx hosted control panel

    mentlity Level 1

      Anybody please! I'm a web designer not a programmer, I foolishly  agreed to upload a flash banner I did for a client. I did not realize it  needed to be uploaded to an .aspx controlled site.  The page I need to  put the banner on already has a Flash banner. The  site is hosted by Network Solutions which is ZERO help as they do not  help with 3rd party coding. I'm stuck now with an angry client and this  is my only recourse.

      Below is the original working code for the banner that is on the site  now.

      <script type="text/javascript"  src="/home-ads/swfobject.js"></script>
      <script type="text/javascript">
      var flashvars = {};
      flashvars.xmlPath = "/home-ads/powertri-ads.xml";
      var params = {};
      params.wmode = "transparent";
      var attributes = {};
      swfobject.embedSWF("/home-ads/powertri-ads.swf", "home-gallery",  "750", "307", "9.0.0", "/home-ads/expressInstall.swf", flashvars,  params, attributes);
      </script>


      <div id="home-focus" style="width: 750px; height: 307px;">
      <!--<div id="home-gallery">
      <a href="http://www.adobe.com/go/getflashplayer">
      <img  src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif"   alt="Get Adobe Flash player" />
      </a>
      </div>-->
      <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"  codebase="http://fpdownload.adobe.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0"   width="750" height="307" id="myflashvars" align="middle">
      <param name="allowScriptAccess" value="sameDomain" />
      <param name="movie" value="/home-ads/powertri-ads.swf" />
      <param name="FlashVars"  value="xmlPath=/home-ads/powertri-ads.xml">
      <param name="quality" value="high" />
      <param name="bgcolor" value="#ffffff" />
      <embed src="/home-ads/powertri-ads.swf"  FlashVars="xmlPath=/home-ads/powertri-ads.xml" quality="high"  bgcolor="#ffffff" width="750" height="307" name="myflashvars"  align="middle" allowScriptAccess="sameDomain"  type="application/x-shockwave-flash"  pluginspage="http://www.adobe.com/go/getflashplayer" />
      </object>
      </div>


      Now my banner does not have the same code it is similar but NOT the same as I copied the html from the javascript and object tags, I have a post on the .asp net forum and nobody answered which tells me this is more a flash problem.



      <script language="JavaScript"  type="text/javascript">
      AC_FL_RunContent(
      'codebase',  'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0',
      'width', '750',
      'height', '307',
      'src', '/home-ads/BannerRotator_Thumbs',
      'quality', 'high',
      'pluginspage', 'http://www.adobe.com/go/getflashplayer',
      'align', 'middle',
      'play', 'true',
      'loop', 'true',
      'scale', 'showall',
      'wmode', 'window',
      'devicefont', 'false',
      'id', '/home-ads/BannerRotator_Thumbs',
      'bgcolor', '#ffffff',
      'name', '/home-ads/BannerRotator_Thumbs',
      'menu', 'true',
      'allowFullScreen', 'false',
      'allowScriptAccess','sameDomain',
      'movie', '/home-ads/BannerRotator_Thumbs',
      'salign', ''
      ); //end AC code
      </script>

      <div id="home-focus" style="width: 750px; height: 307px;">
      <!--<div id="home-gallery">
      <a href="http://www.adobe.com/go/getflashplayer">
      <img  src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif"   alt="Get Adobe Flash player" />
      </a>
      </div>-->

      <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"  codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0"   width="750" height="307" id="/home-ads/BannerRotator_Thumbs"  align="middle">
      <param name="allowScriptAccess" value="sameDomain" />
      <param name="allowFullScreen" value="false" />
      <param name="movie" value="/home-ads/BannerRotator_Thumbs.swf"  /><param name="quality" value="high" /><param name="bgcolor"  value="#ffffff" />     <embed  src="/home-ads/BannerRotator_Thumbs.swf" quality="high"  bgcolor="#ffffff" width="750" height="307"  name="/home-ads/BannerRotator_Thumbs" align="middle"  allowScriptAccess="sameDomain" allowFullScreen="false"  type="application/x-shockwave-flash"  pluginspage="http://www.adobe.com/go/getflashplayer" />
      </object>

      </div>


      Can someone have a look at this and tell me WHY! I  cannot get this to work?

      Any help is appreciated

        • 1. Re: Embedding Flash in an .aspx hosted control panel
          Ned Murphy Adobe Community Professional & MVP

          It almost appears as if you have two different embedding attempts in the html code you show.  Your best bet may be to publish an html page using Flash when you publish the swf and then copy/paste the relevant code from that page into your web page code.  Then you need to be sure to upload any relevant js file to the server per whatever the html code specifies as a link for it.

          • 2. Re: Embedding Flash in an .aspx hosted control panel
            mentlity Level 1

            Man, this is unbelievable! I was able to find out a few things. First, I found that Network Solutions does not allow .as files on their servers so this is whay the attempt at the 2nd code did not work.

             

            This job is for a client I have access to the control panel and from looking at the original banner code (which was done using a version of Flash other than CS4. Below is the second banner I have tried to load, it has the flash object file and an internal actionscript file so I thought I would have been OK. What I ended up doing to by time is to download the original xml file from the client's server and rename the images to the names of my images then uploaded to the correct folder on the site and the result was my images in the client's original swf but I still need to upload MY banner. I do need to know if I'm supposed to  copy the full html from the head or just the code from the javascript below? Then I would need to put the embed code in the correct <div id> which I would copy from the original and place it before the object tag.

             

            I also notice that this banner has no external xml link so I would think that if the xml folder is put in the same folder as the banner this should work?

             

            Any idea how and what to embed?

             

            <script language="JavaScript" type="text/javascript">
                AC_FL_RunContent(
                    'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0',
                    'width', '750',
                    'height', '307',
                    'src', 'banner',
                    'quality', 'high',
                    'pluginspage', 'http://www.adobe.com/go/getflashplayer',
                    'align', 'middle',
                    'play', 'true',
                    'loop', 'true',
                    'scale', 'showall',
                    'wmode', 'window',
                    'devicefont', 'false',
                    'id', 'banner',
                    'bgcolor', '#ffffff',
                    'name', 'banner',
                    'menu', 'true',
                    'allowFullScreen', 'false',
                    'allowScriptAccess','sameDomain',
                    'movie', 'banner',
                    'salign', ''
                    ); //end AC code
            </script>
            <noscript>
                <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="750" height="307" id="banner" align="middle">
                <param name="allowScriptAccess" value="sameDomain" />
                <param name="allowFullScreen" value="false" />
                <param name="movie" value="banner.swf" /><param name="quality" value="high" /><param name="bgcolor" value="#ffffff" />    <embed src="banner.swf" quality="high" bgcolor="#ffffff" width="750" height="307" name="banner" align="middle" allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.adobe.com/go/getflashplayer" />
                </object>
            </noscript>
            </body>
            </html>

            • 3. Re: Embedding Flash in an .aspx hosted control panel
              Ned Murphy Adobe Community Professional & MVP

              You do not need to load any .as files to the server.   .as files are compiled into the swf file when you publish it.

               

              For the code you show below, the head of the html page should include a link to a .js file (AC_RunActiveContent.js), and you will need to load that file to the server wherever it is specified to be... possibly a Scripts folder, but maybe not.

               

              As for any xml file that the swf uses, whatever code is used in the swf to load that file needs to target it as if it is in the html page's folder.  It is easiest done if the html page and swf file are in the same folder to begin with (when being designed).

              • 4. Re: Embedding Flash in an .aspx hosted control panel
                mentlity Level 1

                Ah, I see as i removed the .as files from the folder and the banner 

                works (on my desktop) so thats one thing done now this banner is made 

                up of the following files:

                 

                fla

                html

                swf

                xml

                then an images and thumbs folder

                 

                in order for this to keep the same path I would need to load all these 

                files (except the .fla) up to the folder on the server where the 

                banner goes correct?

                 

                Now in the html code there is javascript in the head and then another 

                javascript code in the body which has the ac run code. Then comes the 

                object embed code, do I copy the javascript in the head and body or 

                just the js in the body and embed code (and change the body tag to the 

                div where it belongs?)

                 

                ???

                • 5. Re: Embedding Flash in an .aspx hosted control panel
                  Ned Murphy Adobe Community Professional & MVP

                  Yes, load all those files (except the fla), as well as the javascript file I named in my last response.

                   

                  You need to include the code in the head section that links that javascript file to the html page as well as the section of code you showed in your second to last response..

                  • 6. Re: Embedding Flash in an .aspx hosted control panel
                    mentlity Level 1

                    OK so if I have to load the javascript code from the head the script 

                    stops where the head ends then a new javascript starts in the body. Do 

                    I leave out the orange andjust copy and paste the whole code?

                     

                    See below:

                     





                     

                    0) {

                                             versionRevision = versionRevision.substring(0, 

                    versionRevision.indexOf("d"));

                                        }

                                   }

                                   var flashVer = versionMajor + "." + versionMinor + "." + 

                    versionRevision;

                              }

                         }

                         // MSN/WebTV 2.6 supports Flash 4

                         else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.6") != 

                    -1) flashVer = 4;

                         // WebTV 2.5 supports Flash 3

                         else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.5") != 

                    -1) flashVer = 3;

                         // older WebTV supports Flash 2

                         else if (navigator.userAgent.toLowerCase().indexOf("webtv") != -1) 

                    flashVer = 2;

                         else if ( isIE && isWin && !isOpera ) {

                              flashVer = ControlVersion();

                         }     

                         return flashVer;

                    }

                    // When called with reqMajorVer, reqMinorVer, reqRevision returns true 

                    if that version or greater is available

                    function DetectFlashVer(reqMajorVer, reqMinorVer, reqRevision)

                    {

                         versionStr = GetSwfVer();

                         if (versionStr == -1 ) {

                              return false;

                         } else if (versionStr != 0) {

                              if(isIE && isWin && !isOpera) {

                                   // Given "WIN 2,0,0,11"

                                   tempArray         = versionStr.split(" ");      // ["WIN", "2,0,0,11"]

                                   tempString        = tempArray[1];               // "2,0,0,11"

                                   versionArray      = tempString.split(",");     //

                              } else {

                                   versionArray      = versionStr.split(".");

                              }

                              var versionMajor      = versionArray[0];

                              var versionMinor      = versionArray[1];

                              var versionRevision   = versionArray[2];

                                  // is the major.revision >= requested major.revision AND the 

                    minor version >= requested minor

                              if (versionMajor > parseFloat(reqMajorVer)) {

                                   return true;

                              } else if (versionMajor == parseFloat(reqMajorVer)) {

                                   if (versionMinor > parseFloat(reqMinorVer))

                                        return true;

                                   else if (versionMinor == parseFloat(reqMinorVer)) {

                                        if (versionRevision >= parseFloat(reqRevision))

                                             return true;

                                   }

                              }

                              return false;

                         }

                    }

                    function AC_AddExtension(src, ext)

                    {

                       if (src.indexOf('?') != -1)

                         return src.replace(/\?/, ext+'?');

                       else

                         return src + ext;

                    }

                    function AC_Generateobj(objAttrs, params, embedAttrs)

                    {

                       var str = '';

                       if (isIE && isWin && !isOpera)

                       {

                         str += '';

                       }

                       document.write(str);

                    }

                    function AC_FL_RunContent(){

                       var ret =

                         AC_GetArgs

                         (  arguments, ".swf", "movie", "clsid:d27cdb6e-

                    ae6d-11cf-96b8-444553540000"

                          , "application/x-shockwave-flash"

                         );

                       AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);

                    }

                    function AC_SW_RunContent(){

                       var ret =

                         AC_GetArgs

                         (  arguments, ".dcr", "src", "clsid:

                    166B1BCA-3F9C-11CF-8075-444553540000"

                          , null

                         );

                       AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);

                    }

                    function AC_GetArgs(args, ext, srcParamName, classid, mimeType){

                       var ret = new Object();

                       ret.embedAttrs = new Object();

                       ret.params = new Object();

                       ret.objAttrs = new Object();

                       for (var i=0; i < args.length; i=i+2){

                         var currArg = args[i].toLowerCase();

                         switch (currArg){     

                           case "classid":

                             break;

                           case "pluginspage":

                             ret.embedAttrs[args[i]] = args[i+1];

                             break;

                           case "src":

                           case "movie":     

                             args[i1] = AC_AddExtension(args[i1], ext);

                             ret.embedAttrs["src"] = args[i+1];

                             ret.params[srcParamName] = args[i+1];

                             break;

                           case "onafterupdate":

                           case "onbeforeupdate":

                           case "onblur":

                           case "oncellchange":

                           case "onclick":

                           case "ondblclick":

                           case "ondrag":

                           case "ondragend":

                           case "ondragenter":

                           case "ondragleave":

                           case "ondragover":

                           case "ondrop":

                           case "onfinish":

                           case "onfocus":

                           case "onhelp":

                           case "onmousedown":

                           case "onmouseup":

                           case "onmouseover":

                           case "onmousemove":

                           case "onmouseout":

                           case "onkeypress":

                           case "onkeydown":

                           case "onkeyup":

                           case "onload":

                           case "onlosecapture":

                           case "onpropertychange":

                           case "onreadystatechange":

                           case "onrowsdelete":

                           case "onrowenter":

                           case "onrowexit":

                           case "onrowsinserted":

                           case "onstart":

                           case "onscroll":

                           case "onbeforeeditfocus":

                           case "onactivate":

                           case "onbeforedeactivate":

                           case "ondeactivate":

                           case "type":

                           case "codebase":

                           case "id":

                             ret.objAttrs[args[i]] = args[i+1];

                             break;

                           case "width":

                           case "height":

                           case "align":

                           case "vspace":

                           case "hspace":

                           case "class":

                           case "title":

                           case "accesskey":

                           case "name":

                           case "tabindex":

                             ret.embedAttrs[args[i]] = ret.objAttrs[args[i]] = args[i+1];

                             break;

                           default:

                             ret.embedAttrs[args[i]] = ret.params[args[i]] = args[i+1];

                         }

                       }

                       ret.objAttrs["classid"] = classid;

                       if (mimeType) ret.embedAttrs["type"] = mimeType;

                       return ret;

                    }

                    // -->



                     

                    <!url's used in the movie>

                    <!text used in the movie>

                     

                    </html

                    • 7. Re: Embedding Flash in an .aspx hosted control panel
                      mentlity Level 1

                      I found out a few things as I'm poking around a bit. Before I do I just need to make sure that I'm copying ALL the code I need to copy. Are you sure ALL the javascript in the head AS WELL AS the javascript in the body needs to be copied?

                       

                      thx

                       

                      RD

                      • 8. Re: Embedding Flash in an .aspx hosted control panel
                        Ned Murphy Adobe Community Professional & MVP

                        Your best bet will be to take the html page that Flash creates and load it to your client's server to make sure that works for starters.  If that goes okay then see about moving it into your client's page.  As far as I know, Flash doesn't create any unnecessary code when it publishes an html file... different versions will publish different stuff.  So if there is a whole bunch of javascript in the head section then it all needs to be put in the client's file.  Flash CS3 created most of that code as a separate js file, but CS4 may place the code right into the html page instead.

                        • 9. Re: Embedding Flash in an .aspx hosted control panel
                          mentlity Level 1

                          I'm going to copy and paste all the java to the control panel to see if it displays. I found that the images are absolute paths so even though the flash banner and its files are all in the same folder the images in the original.xml file go httpscd.com/images/folder instead of the way it now relative. i also contacted the people who made the banner as I cannot move the xml path without using Flash vars. I can figure it out with their help and I appreciate you looking into this for me.

                           

                          I'll re post if something comes up.

                           

                           

                          rd

                          • 10. Re: Embedding Flash in an .aspx hosted control panel
                            mentlity Level 1

                            OK, after going nuts I was able to contact the guys who did the banner and I found out what the problem was. Rather than write a drawn out explaination I'll get right to it. First, if you are in CS4 you DO NOT have to copy the javascript from the head of the html doc, just the body javascript. Second, even though my xml file is in the same folder as my banner the files were put in the same folder of the server, what I did not see was that the original banner images were linked absolute and mine were linked relative, once I figured that out I remember looking in the original xml and saw it was linked using Flash Vars and that was one of the problems. So I added the flash vars link to the xml file and it still would not work, but the guys who did the banner say they see the banner now. I sould not see it because I'm on a Mac and I just used the object tag. So if you look at the page on a pc you would have seen the banner dispaly. So I was given the correct code using the object and embed tags along with adding Flash vars inside both tags and it worked.

                             

                            Thanks to Ned Murphy "the man" who educated me on embedding and .as files. If anyone wants to see the correct wat to code look below

                             

                            add the javascript in the html first then in the proper div tag where the banner goes add the following

                             

                            <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="750" height="307" id="yourbanner." align="middle">
                                        <param name="allowScriptAccess" value="sameDomain" />
                                        <param name="allowFullScreen" value="false" />
                                     <param name="FlashVars" value="xmlPath=/yourfolder/yourbanner.xml" />
                                        <param name="movie" value="/yourfolder/yourbanner..swf" /><param name="quality" value="high" /><param name="bgcolor" value="#ffffff" />            <embed src="/yourfolder/yourbanner..swf" Flashvars="xmlPath=/yourfolder/yourbanner..xml" quality="high" bgcolor="#ffffff" width="750" height="307" name="/yourfolder/yourbanner." align="middle" allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.adobe.com/go/getflashplayer" />
                                        </object>
                            </div>

                             

                            thx

                            rd