2 Replies Latest reply on Aug 16, 2007 8:33 AM by Terminum

    AC_RunActiveContent.js error

    Terminum
      Hi,

      When I view my swf in a browser I get an error stating that AC_RunActiveContent.js is required. This doesn't happen on my computer when viewed locally, but it happens on others whether it's hosted locally or remotely. The only thing embedded in the page is a swf that has action script with no external classes or anything that would apparently need a javascript file. This is my first time using flash cs3, but I made it a AS 2.0 file and I have never had this error with the ActionScript I am using. Why is this error occuring and how can I prevent it?

      Also, I read the adobe documentation regarding external JavaScript solutions that mentions the AC_RunActiveContent.js but didn't find it helpful.

      Thanks
        • 1. Re: AC_RunActiveContent.js error
          fire orchid Level 1
          Put this code into a text file and save as:

          "AC_RunActiveContent.js"

          into a folder called "Scripts".

          ==========================================



          //v1.0
          //Copyright 2006 Adobe Systems, Inc. All rights reserved.
          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 = '<object ';
          for (var i in objAttrs)
          str += i + '="' + objAttrs + '" ';
          str += '>';
          for (var i in params)
          str += '<param name="' + i + '" value="' + params
          + '" /> ';
          str += '<embed ';
          for (var i in embedAttrs)
          str += i + '="' + embedAttrs + '" ';
          str += ' ></embed></object>';

          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
          .toLowerCase();

          switch (currArg){
          case "classid":
          break;
          case "pluginspage":
          ret.embedAttrs[args ] = args[i+1];
          break;
          case "src":
          case "movie":
          args[i+1] = AC_AddExtension(args[i+1], 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":
          ret.objAttrs[args
          ] = args[i+1];
          break;
          case "width":
          case "height":
          case "align":
          case "vspace":
          case "hspace":
          case "class":
          case "title":
          case "accesskey":
          case "name":
          case "id":
          case "tabindex":
          ret.embedAttrs[args ] = ret.objAttrs[args] = args[i+1];
          break;
          default:
          ret.embedAttrs[args ] = ret.params[args] = args[i+1];
          }
          }
          ret.objAttrs["classid"] = classid;
          if (mimeType) ret.embedAttrs["type"] = mimeType;
          return ret;
          }

          ==========================================

          Then in the html file holding your swf, add this in the <head> section:

          ==========================================

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

          ==========================================

          and this in the body section:

          ==========================================

          <script type="text/javascript">
          AC_FL_RunContent( 'codebase',' http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,29,0','wid th','800','height','550','src','swfname','quality','high','pluginspage','http://www.macrom edia.com/go/getflashplayer','movie','swfname','salign','lt','bgcolor','#FFFFFF','scale','n oborder' ); //end AC code
          </script>

          ==========================================

          replacing "swfname" with the name of your swf and obviously the height and width properties to match your movie


          well, that's what i do anyway, and it seems to work. someone else might have a better or more updated resolution...

          Mandi
          • 2. Re: AC_RunActiveContent.js error
            Terminum Level 1
            Thanks for the reply Mandi, but I must be doing something wrong because I still can't get this to work. Why is it necessary to do this now? Is it possible to not use javascript? What happened to 1 step publishing?