ClickTags in ActionScript 2.0
ClickTags should be easy... but they are not so simple. Firstly, because some ads built for polite loading require a parent swf that loads a child swf, we must access the clicktag value through "_level0" and not "_root" in AS2. Also, some vendors who shall remain nameless but not shameless, refuse to use "clickTag" and prefer "clickTAG." Why? I have no idea. "TAG" does not stand for anything like "XML." Whenever we use "XML" in the naming of a function or variable, we capitalize, but not "TAG", that's senseless. And since Flash is case-sensitive, we can not ignore this difference. So we must check for both if we want a universal function to handle everything.
Another common question is whether to place it above everything or below everything on the stage. In AS2, a button on top of other buttons may intercept the click/rollover action intended for the button below it. We don't want to obscure any funky mouseover states, such as call-to-action rollovers, by laying a big invisible button over the movie. Though not all ads have interactive elements, it makes sense to layer the catch-all clicktag behind other elements in case interactivity is needed. Some clicktag tutorials suggest putting it on top for simplicity’s sake. Ignore this. This is done to avoid having to explain that the clicktag action also needs to be on those other buttons in the movie - or clicking on them will do nothing. Mouseover states are important to user feedback.
The last thing to consider is how to properly create an invisible button. This has nothing to do with "_alpha." Simply create a button and place the hit area block in the "hit" frame (frame 4) of the button. Leave the rest of the frames blank. The movieclip will appear blue on the screen. The reason using this over _alpha is important because using _alpha=0 will force Flash to render those pixels over your animation. Rendering _alpha channels should be avoided if necessary as it requires processor power.
ClickTags in ActionScript 3.0
AS3 is another monster entirely. Anyone's who broke into programming with AS2 will see AS3 as fairly daunting. It's ugly. It requires many lines more text to get simple things done. And every turn requires a class of some sort or another. Let's face it, the good ol' days of slash and burn programming with AS2 are over. It's not a bad thing. More like migrating from pitchforks to laser scapuls. We just need a steadier hand. In AS3 we don't have _global, _root, or _level0. We have to use "root.loaderInfo" to access FlashVars. I won't include here how to pass variables to an AS3 child movie because it's a bit of a bugger. But check this aritcle out if you're curious. You'll also have problems with other movieclips intercepting mouse events through various layers. There may be cause to use AS3's "mouseEnabled" and "mouseChildren" properties to set this straight. I'll save this for another article. Very few ads are ever done in AS3. Mainly because of habit. Anyone who dares site Flash Player penetration and the reason hasn't seen recent numbers: 98%-99% in the developed world. Not for Player 10 mind you.
Below is the code for AS2 and AS3.
|