Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.

ClickTAG in AS2 needed in AS3

Yametazamwa mara 77
Ruka hadi kwenye ujumbe wa kwanza ambao haujasomwa

txwebdesigner2

hayajasomwa,
29 Jan 2008, 18:42:2129/01/2008
kwa
I need to write this code:

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

into an ActionScript 3 "main timeline" format hopefully using an event
listener to a button I have created.

David Stiller

hayajasomwa,
29 Jan 2008, 19:47:2729/01/2008
kwa
txwebdesigner2,

I'm with ya. There are usually a number of ways to solve any given
problem in Flash (actually, in programming in general). Here's a clickTAG
approach in ActionScript 3.0:

myButton.addEventListener(
MouseEvent.CLICK,
function():void {
if (root.loaderInfo.parameters.clickTAG.substr(0,5)=="http:") {
navigateToURL(
new URLRequest(root.loaderInfo.parameters.clickTAG),
"_blank"
);
}
}
);

Keep in mind, the concept "clickTAG" is not, per se, a feature of Flash.
What's going on here is something called FlashVars, which is one of many
mechanisms for getting external data inside a SWF at runtime. It just
happens that ad tracking agencies have loosely agreed to a naming convention
for this particular piece of data. Most companies call it some version of
clickTAG (might be ClickTAG, ClickTag, clickTag, and other variations).
ActionScript 3.0 is case sensitive, so the capitalization matters.

In the above suggestion, the same thing happens as in the original
pre-AS3 suggestions on the Adobe site: the SWF checks to see if a variable
named clickTAG contains a string. Actually, it checks whether the first six
characters (0 through 5) are "http:". If so, a URL request is made to
whatever URL is stored in the clickTAG variable. The URL is generally a
hyperlink that uniquely identifies this particular ad for tracking purposes.
The URL is provided from outside the SWF altogether, so it's not something
you can easily test for in Flash without having the HTML that embeds the
SWF.


David Stiller
Co-author, Foundation Flash CS3 for Designers
http://tinyurl.com/2k29mj
"Luck is the residue of good design."


aniebel

hayajasomwa,
30 Jan 2008, 06:22:3730/01/2008
kwa
txwebdesigner2, hi...

Just curious. Which site is asking you to provide something in AS3? I've been
waiting to see when the standard for Flash Player versions to be increased to
Flash Player 9. In my experience, most sites will not allow any version higher
than 7 which means I am stuck with AS2. Let me know if you don't mind. Thanks!

Ovidio Vela, Jr.

hayajasomwa,
4 Feb 2008, 15:59:0004/02/2008
kwa
Thanks everyone for your help.

Ovidio Vela, Jr.

hayajasomwa,
4 Feb 2008, 15:53:1804/02/2008
kwa
Actually I had already designed a banner in AS3 cause that's what I know. Once
it was completed the client asked for this ClickTAG functionality. So it is
either find a way to write the code in AS3 or redo the banner in AS2. I just
like using the Transition Managers in AS3.

calamity224

hayajasomwa,
17 Okt 2008, 15:57:5517/10/2008
kwa
Does this code work for Google adserve?
I keep getting an error

xxjoeb...@gmail.com

hayajasomwa,
12 Des 2008, 15:13:5312/12/2008
kwa
On Oct 17, 1:57 pm, "calamity224" <webforumsu...@macromedia.com>
wrote:

> Does this code work for Google adserve?
> I keep getting an error

I know that this post is super old, however here is the proper code to
use clickTAG and have it work with google adserve in AS3. Just replace
every & in the clickTAG Url with a ~ and you'll be set. It converts it
back on the other end. The reason you have to do this is because & is
reconigized in AS3 and ~ is not.

[code]
ButtonName.addEventListener(MouseEvent.CLICK, functionName)
{

function functionName(event:MouseEvent) : void
{
if (root.loaderInfo.parameters.clickTAG.substr(0, 5) == "http:")
{
Url = String(root.loaderInfo.parameters.clickTAG).split
("~").join("&");
navigateToURL(new URLRequest(Url), "_blank");
}// end if[/code]

Ujumbe 0 mpya