Last week we've been struggling to get our AS3 banners ready for publication.
One of the more common problems anyway, is that some ad management systems requiress clickTag (lowercase "ag") and others requires clickTAG (uppercase "AG") in order to load the right URL. This is very annoying, especially when you have to make 2 versions for different publishers and you need to do a text change... When you have a big capaign with let's say 5 banner formats, and 3 banner variants, you already have to make 15 different banners. In case you need to deliver banners with a clickTag and a clickTAG, you'll end up with 30 banners. In case you've ever build banners yourself, you see my point. It's soo easy to lose the overview when you have so many files looking almost identical to each other.
A new problem with banner build using AS3, is that some browsers will block the navigateToURL requests. A trick for this is let javascript open the URL instead of actionscript.
Both of these things have been recently an issue, so that's why I decided this weekend to wrap this all up in a clickTag class, which is universal for all different case combinations of the word clickTag. Beside that, it will open URL's correctly without a browser which is blocking it. (at least, as far a I know).
Instead of adding a button on the stage, set up all the event listeners etc, you can now use:
var clickTag:ClickTag = new ClickTag(300,250);
clickTag.enableClickTag();
addChildAt(clickTag,0);
It's just as simple as that. In case you want a custom shaped button, you need to assign it to clickTag by using "clickTag.setButton(btn);".
In order to open the links correctly, you need to make sure that the parameter AllowScriptAccess is set to "always":
<param name="AllowScriptAccess" value="always">
Download this class and it's examples in Flash and Flex here!
Tags: Actionscript, Javascript // 9 Comments »