views:

343

answers:

4

I made a banner ad and the site gave me this code to work with:

on (release) {
if (clickTAG.substr(0,5) == "http:" ) {

getURL(clickTAG, "_blank");
}
}

I made an invisible layer and put this code on it. The swf showed the hand, but when I clicked on the banner nothing happened, on my end or on the live site.

Then I used this code:

on(release)
{getURL(clickTag,"_blank")}

On my end it would open a blank page. On their end they got a 404 message.

Why is it not connecting to the server and opening the link? Is there something in my file that could be preventing either clickTAG from working?

I exported in Flash 9. I'm using a loop code. I have many layers and masks, but all are under the invis. layer.

A: 

For Flash 9, try the following instead of the code you are currently using:

on (release) {
  if (_root.clickTAG.substr(0,5) == "http:") {
    getURL(_root.clickTAG, "_blank");
  }
}
Sinan Taifour
A: 

Did you put the code on a layer or on an invisible button? That code needs to go on an invisible button, and the button needs to go over all the elements of you page.

  • To create an invisible button, create a new button symbol and don't put anything on any of the frames except the 4th (hit) frame.

  • Drag this button to the topmost layer and put it above everything else. Click on the button, open the actions window, and paste your code in there.

Goose Bumper
A: 

Strange coincidence, I'm also working with a company using clickTAG to pass URLs to SWF banners.

Are you sure they are including the clicktag in the URL? so the URL is something like this:

http://www.yoururl.com/yourbannerad.swf?clickTAG=http://www.yourwebsiteurl.com

that's the first thing to check.

the next is to make sure your click is working. Instead of trying to load the clickTAG variable, try a test to ensure that the click is working at all:

on(release)
{getURL("http://www.google.com","_blank")}

This will ensure that there are no hidden layers or movie clips that are getting in the way.

If that works, try getting the clickTAG in a different browser. There's a little-known bug in IE where parameters sent to a SWF after a 302 redirect are stripped out if the first URL also has parameters. I've heard reports that this also occasionally occurs in Firefox.

More info on the bug:

http://www.markledford.com/blog/2008/07/24/serious-and-seriously-obscure-bug-with-flash-embed-code-variables-and-ie/

Basically it's saying that if the URL from the ad network is:

http://www.adnetwork.com/track?a=1&b=2

then that URL does a 302 redirect to:

http://www.yoururl.com/yourbannerad.swf?clickTAG=http://www.yourwebsiteurl.com

Then your SWF will be able to read a=1&b=2 but not be able to read clickTAG=http://www.yourwebsiteurl.com

Unfortunately the only real workaround for that bug is to reformat the first URL so the parameters aren't sent using ?a=1&b=2 but rather with an arbitrary format like $a:1|b:2.

Since most ad networks return banner ads from a dynamic URL with a lot of parameters for tracking and reporting purposes, this is most likely the cause of the issue.

nerdabilly
A: 

This problem was resolved. It was either one or both of two things.

The invisible layer was a moviclip. I changed it to a button.

The code had some spaces in it. I cleaned it up and deleted the spaces.

The file worked perfectly after that.

Flash can be so fickle!

jecca411