Primarily at my work I do flash banners. Often I'll use MediaMind or DoubleClick, however there's obviously times when I need to develop the ads to meet the requirements of certain publishers like NineMSN and Yahoo!
Each of these have different specs for their "clickTag". The clickTag is basically just the name of a variable which is parsed into flashvars and contains the clickthrough URL for when people click the advertisement.
Here are a few that are out and about:
clickTag
clickTAG
_root.clickTag
_level0.clickTag
And any combination of the above (ie different casing, etc).
I figured that _root
and _level0
were unnecessary, so I removed them. Then I got blasted by one of the publishers saying that the clickTag was incorrect (because I'd removed the _root
from the front). She was using some online tool that allowed them to view the actionscript applied to the button, they hadn't actually tested the ad in their system to see if it worked.
So, question 1: I'm almost certain that _root.var
, _level0.var
and var
are all the same thing (from the _root
/ main timeline obviously). Unless maybe it can be parsed through flashvars in a way that makes the variable only accessible via _level0
or _root
(you can't do this as far as I know).
Question 2: Another thing I got picked up on was applying the click in the timeline rather than directly onto the button itself (I hate placing any code directly onto objects). Like so:
btn.onRelease = function():Void
{
getURL(clickTag, "_blank");
}
Rather than this placed onto the button itself:
on(release)
{
getURL(clickTag, "_blank");
}
I don't see how there could possibly be a difference here either, or is there?
My final question is: I spend an hour creating 12 copies of 3 different ad sizes in two different styles to apply the appropriate clickTag to each of the banners to send directly to the publishers. Why can't I just create a single super-clickTag like this?
var clicktags:Array = [clickTag, clickTAG, uncommonClickTag];
btn.onRelease = function():Void
{
var i:Number = 0;
for(i; i<clicktags.length; i++)
{
var s:String = clicktags[i];
if(s != undefined)
{
getURL(s, "_blank");
break;
}
}
}
Question 1: You are quite correct, and your publisher colleague is mistaken, however she is (working for) the boss, and probably does not have the understanding required to accept your solution. It's safer for her to run the banner through some opaque tool and get the ok, whereas it's definitely 'rocking the boat' to ask her boss to accept your perfectly-formed 'irregularities'.
Also, can you be absolutely sure that your banner wont be loaded into another swf (breaking the _rootless code)? Unlikely perhaps, but if something can go wrong...
And finally, question 3 makes the whole thing moot, as you will see. Yes, you can indeed do something like your code snippet, but you will have to use strings for the flashvar names, and do the undefined test against the tag value got from _root[flashVarNameString] like this:
var clicktags:Array = ["clickTag", "clickTAG", "uncommonClickTag"];
btn.onRelease = function():Void
{
var i:Number;
for(i; i<clicktags.length; i++)
{
var s:String = clicktags[i];
var tagVal:String = _root[s];
if(tagVal != undefined)
{
getURL(s, "_blank");
break;
}
}
}