I am trying to place a clickTag inside a banner ad in CS3. I am writing this
with an invisible button:
on(release){
getURL(clickTag, "_blank");
}
---------------------------------------
My question is, how do I embed the url? Should I also create a regular button
and add the url? Actually seems like when I do that the button is not working
either. I dont knwo any actionscripting so a simple and detailed answer is
greatly appreciated. Thanks in advance for help.
> I am trying to place a clickTag inside a banner ad in CS3.
There are two important concepts to keep in mind, here: a) the term
"clickTag" isn't a feature of Flash, per se (more on that in a sec); it's
just one example of an approach through which information can be fed into a
SWF from the outside; b) Flash CS3 allows you to write ActionScript 3.0,
2.0, and 1.0: it's the language you choose that dictates how to actually
handle your clickTag.
To elaborate a bit on that first point, the term "clickTag" (or
"ClickTag", "ClickTAG", or dozens of other variants) is nothing more than a
convention for the name of a variable. It's a loosely followed convention,
at best, which is unfortunate because ActionScript is effectively case
sensitive as of Flash Player 7. If you're looking for clickTag, for
example, and it's supposed to be ClickTag (or vice versa), you'll come up
dry, because Flash Player considers those two different variables. The
technique in question is simply a way to program Flash to open a URL
hyperlink -- without the banner creator having to know beforehand what that
URL will be. The URL is passed into the SWF from the outside; specifically,
from the HTML that embeds the SWF.
This can be done in two ways: something called FlashVars and a query
string. Both techniques are similar and will be taken care of by whoever
puts together the HTML document. All you need to care about, as a Flash
designer/developer, is what the HTML person chose to name the variable. In
the case of either technique, that variable will magically appear for you in
the SWF at runtime. All you have to do is reference it.
In this code, for example ...
on(release) {
getURL(clickTag, "_blank");
}
... clickTag doesn't inherently mean anything. It won't mean anything when
you test your SWF in the IDE, either. It doesn't/won't mean anything
because it's a variable that has no value. Remember, that value is provided
by the HTML that embeds the SWF and uses either FlashVars or a query string.
The code shown will work in everything but a document configured for
ActionScript 3.0. In ActionScript 3.0, the location of the magically
imported variable is in a different place, as described here (not a
clickTag-related article, but may still help you):
http://www.quip.net/blog/2007/flash/how-to-retrieve-flashvars-data-in-actionscript-30
> My question is, how do I embed the url?
The URL (the value of clickTag) is supplied by FlashVars or a query
string, as described here:
http://www.quip.net/blog/2006/flash/how-to-tell-swf-from-outside
> Should I also create a regular button and add the url?
The reason the URL is not supplied by hand is because it might change.
If it changes, you would need to recompile the SWF under normal
circumstances, but here, you only need to update the HTML.
> Actually seems like when I do that the button is not working
> either.
If your document is configured for ActionScript 3.0, the on() function
doesn't work (neither does onClipEvent(). Event handling is considerably
different in AS3, and some of that is dicussed here:
http://www.quip.net/blog/2007/flash/making-buttons-work-in-flash-cs3
David Stiller
Co-author, Foundation Flash CS3 for Designers
http://tinyurl.com/2k29mj
"Luck is the residue of good design."
> David, I cant thank you enough. Hugs.
Aw, thanks!
David Stiller
Adobe Community Expert
Dev blog, http://www.quip.net/blog/