3 Replies Latest reply on Jun 16, 2015 6:33 AM by rezun8

    Something like a universal clickTAG AS3 code?

    ricardsp79919285

      Hello! I got this code from my client to be used in a set of banners for a campaign:

       

      on (release) // universal clicktag

      {

            if (ClickTag != null) { getURL(ClickTag, "_blank"); }

      else if (clickTAG != null) { getURL(clickTAG, "_blank"); }

      else if (clicktag != null) { getURL(clicktag, "_blank"); }

      else if (_root.link1 != null) { getURL(_root.link1, "_blank"); }

      else if (_root.clickTAG != null) { getURL(_root.clickTAG, "_blank"); }

      }

       

      This is AS2 and I am not sure if it works, but since they gave it to me, it should. The question - is there a similar AS3 version out there? Since I am using Flash Professional CC.

       

      I was trying something like this:

       

      Link.addEventListener(

        MouseEvent.CLICK,

        function():void {

          if (root.loaderInfo.parameters.clickTAG.substr(0,5) == "http:") {

            navigateToURL(

              new URLRequest(root.loaderInfo.parameters.clickTAG), "_blank"

            );

          }

          else if (root.loaderInfo.parameters.clickTag.substr(0,5) == "http:") {

            navigateToURL(

              new URLRequest(root.loaderInfo.parameters.clickTag), "_blank"

            );

          }

          else if (root.loaderInfo.parameters.clicktag.substr(0,5) == "http:") {

            navigateToURL(

              new URLRequest(root.loaderInfo.parameters.clicktag), "_blank"

            );

          }

          else if (root.loaderInfo.parameters._root.link1.substr(0,5) == "http:") {

            navigateToURL(

              new URLRequest(root.loaderInfo.parameters._root.link1), "_blank"

            );

          }

          else if (root.loaderInfo.parameters.ClickTag.substr(0,5) == "http:") {

            navigateToURL(

              new URLRequest(root.loaderInfo.parameters.ClickTag), "_blank"

            );

          }

          else if (root.loaderInfo.parameters._root.clickTAG.substr(0,5) == "http:") {

            navigateToURL(

              new URLRequest(root.loaderInfo.parameters._root.clickTAG), "_blank"

            );

          }

        }

      );

       

      But no luck, it was running only the first clickTAG version. Any help is appreciated.

        • 1. Re: Something like a universal clickTAG AS3 code?
          Colin Holgate MVP & Adobe Community Professional

          You're getting a substring of an object that may not exist. Try taking out the substr parts.

          • 2. Re: Something like a universal clickTAG AS3 code?
            ricardsp79919285 Level 1

            When removing the substr parts it does solve the problem for most of the clickTAG versions except the two with _root appendix. I am not sure if there are advertising sites using this kind of syntax. Need to check on that, but for most cases this code is valid. Thanks for your help!

            • 3. Re: Something like a universal clickTAG AS3 code?
              rezun8 Level 4

              this is what we use for ClickTAG tracking for use in DoubleClick Studio:

              AS3

               

              //######################################################################################## ############//

              //CLICK TAG

              //######################################################################################## ############//

              function handleClick(mouseEvent:MouseEvent):void {

                  var interactiveObject:InteractiveObject = mouseEvent.target as InteractiveObject;

                  var li:LoaderInfo = LoaderInfo(interactiveObject.root.loaderInfo);

                  var url:String = li.parameters.clickTag;

                  if (url) {

                      if (ExternalInterface.available) {

                          var userAgent:String = ExternalInterface.call('function(){ return navigator.userAgent; }');

               

               

                          if (userAgent.indexOf("MSIE") >= 0) {

                              ExternalInterface.call('window.open', url, '_blank');

                          } else {

                              navigateToURL(new URLRequest(url), '_blank');

                          }

                      } else {

                          navigateToURL(new URLRequest(url), '_blank');

                      }

                  }

              }

              clickTag_btn.addEventListener(MouseEvent.MOUSE_UP,handleClick);

              //######################################################################################## ############//