PDA

View Full Version : clickTag in AS3?



Dimitree
May 8th, 2007, 10:04 AM
Can someone migrate to AS3 this very very useful code?
Especially for Banner makers...

ActionScript Code:



on (release) {
getURL(clickTag, "_blank");
}

jwopitz
May 8th, 2007, 03:52 PM
//add this somewhere in the constructor of your class
addEventListener(MouseEvent.CLICK, onClick);

protected function onClick (evt:MouseEvent):void {
var req:URLRequest = new URLRequest();
req.url = clickTag;
flash.net.navigateToURL(req, "_blank");
}


something like that?

Dimitree
May 9th, 2007, 09:17 AM
Do I have to make a class and put this code inside? Can't I simply put the code on a button instance on the main Timeline?

jwopitz
May 9th, 2007, 10:17 AM
I guess you could just add to the timeline, but I haven't done anything with AS3 and timelines since I do mostly class based stuff. You might have to modify the syntax a bit to get it to work.

Dimitree
May 9th, 2007, 11:06 AM
Thanks again! I ll work on it and give a clue;)

Breen
May 9th, 2007, 11:28 AM
Dimitree, the standard "clickTAG" as described by many company's is quite different from your implementation.

1.Also you should export the file to target flash player 6 as many company's have implemented different clicktag versions ("clickTAG", "clickTag", "clicktag", and so on).

2. You should check the provided link in the following manner, for obvious security reasons:

http://www.adobe.com/resources/richmedia/tracking/designers_guide/

Code needed:

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

hoolagon
October 31st, 2008, 10:22 AM
ActionScript Code:

//add this somewhere in the constructor of your class
addEventListener(MouseEvent.CLICK, onClick);

protected function onClick (evt:MouseEvent):void {
var req:URLRequest = new URLRequest();
req.url = clickTag;
flash.net.navigateToURL(req, "_blank");
}




something like that?

I dont get it. I'm trying to do the same and add and clickTag in AS3. However I get an error during compile time because clickTag is not defined anywhere.

The media company and everywhere I look online just keeps repeating that same old

ActionScript Code:
on (release) {
getURL(clickTag, "_blank");
}

but where and how do I define the clickTag so I can compile the swf?

jwopitz
October 31st, 2008, 10:55 AM
you would have to define clickTag yourself. Often that term refers to some 3rd party API whne talking about stat tracking and submission to external URLs.

McGuffin
October 31st, 2008, 11:19 AM
var clickTag:String = root.loaderInfo.parameters.clickTag;


root is your document class.

tiaanv
November 7th, 2008, 05:51 AM
I have tried everything and I just can't figure out why my output gives me the following error?

TypeError: Error #1010: A term is undefined and has no properties.
at PikumBanner/handleClick()

private function initButton()
{
pikumBTNclick = getChildByName("btn_click") as SimpleButton;
pikumBTNclick.addEventListener(MouseEvent.CLICK, handleClick);
}

private function handleClick(e:MouseEvent)
{
if (root.loaderInfo.parameters.clickTAG.substr(0,4) == "http" || root.loaderInfo.parameters.clickTAG.substr(0, 5) == "https") {
navigateToURL(new URLRequest(root.loaderInfo.parameters.clickTAG),"_blank");
}
else {
navigateToURL(new URLRequest(CLICKTHRU_END_POINT+xml.clickthru+"&Channel="+CHANNEL+"&Source="+p_source+"&Campaign="+p_campaign+"&Detail1="+p_UID+"&Detail2="+p_bannerName+"&Detail3="+p_bannerSize),"_blank");
}
}

Can anyone please help with this?

tbuchok
November 9th, 2008, 06:43 PM
@tiaanv -- if you could provide the FLA, I can try to take a look at the file.

Question for everyone on the thread: Do you know if any publishers/websites accept AS3 banner ads yet? I haven't had any luck getting AS3-coded ads, so I'm still writing our ads in AS2 ... sites seem to be so behind the times (30kb max files size still bugs me).

If you're interested in testing your clicktags, here's a simple tool I use:

http://www.bannerflow.com/clicktest/

(Haven't tested it with AS3 -- YMMV.)

jns.johansson
November 9th, 2008, 08:23 PM
Hey dude, I made a few banners for a company using clickTag and AS3, it's not that complicated and if you google you will find an uberguide for it.

Anyhow, clickTag + AS3 = problems. Because banners targets a large group of people, and a large group of people does not have FP9.

YOU SHOULD NOT USE clickTag + AS3. NOT! :)

Ah, and the URL for the guide, found it, it's neat. http://www.genelu.com/content/view/98/1#AS3

koma
November 21st, 2008, 02:36 PM
Here's code recommended by DoubleClick, there's an issue w/ AS3 getting PopUp blocked w/ a standard url call, so use Flash+Javascript (ExternalInterface call) to avoid blocking:

Link_1.addEventListener(
MouseEvent.MOUSE_UP,
function(event: MouseEvent): void {
var sURL1: String;
if ((sURL1 = root.loaderInfo.parameters.clickTag)) {
void ExternalInterface.call('open', sURL1, '_blank');
}
}
);

Beau
December 10th, 2008, 11:52 AM
I've tried this code from Doubleclick with no success. It seems to work when the swf and the html are in the same directory, but not when the swf is somewhere else.

exocet1313
December 16th, 2008, 06:48 PM
A few months ago, it seems to work in our banner system. Good luck!

// ONLY NEED FUNCTION LISTED ONCE!!!
function getClickTag():String{
for (var key:String in root.loaderInfo.parameters)
if(key.toLowerCase()=="clicktag")
return root.loaderInfo.parameters[key];
return "";
}
// END FUNCTION

// NEED THIS FOR EACH BUTTON - NOTE TO CHANGE THE "clicker_mc" to MATCH YOUR INSTANCE NAME
clicker_mc.addEventListener(MouseEvent.CLICK,funct ion():void {
navigateToURL(new URLRequest(getClickTag()),"_blank");
});

liquidFusion
January 19th, 2009, 03:55 AM
Hey dude, I made a few banners for a company using clickTag and AS3, it's not that complicated and if you google you will find an uberguide for it.

Anyhow, clickTag + AS3 = problems. Because banners targets a large group of people, and a large group of people does not have FP9.

YOU SHOULD NOT USE clickTag + AS3. NOT! :)

Ah, and the URL for the guide, found it, it's neat. http://www.genelu.com/content/view/98/1#AS3


Also, and this is rather important, AS3 trigger pop-up blockers when used with clickTAG - which is why we, sadly, have to use AS2 still (for all types of banner ads)

pulpgirl
January 26th, 2009, 03:47 PM
hello all.
question... very basic. (sorry)
for clickTags.. do i not need to also add my URL somewhere??
is that done in the html that embeds the ad?

clickfinger
February 18th, 2009, 11:11 AM
jns.johansson you are not right!

This works for me in AS3:

private function click(event : MouseEvent) : void {
getURL(LoaderInfo(root.loaderInfo).parameters.clic kTag);
}
private function getURL(url : String,window : String = "_blank") : void {
var broswer : String = ExternalInterface.call("function getBrowser(){return navigator.userAgent}") as String;
if(broswer.indexOf("Firefox") != -1 || broswer.indexOf("MSIE 7.0") != -1) {
ExternalInterface.call('window.open("' + url + '","' + window + '")');
} else {
navigateToURL(new URLRequest(url), window);
}
}

OnDemandDesign
December 17th, 2009, 03:26 PM
Does anyone know if ClickFingers code is good?

rodieman
January 28th, 2010, 05:35 PM
Even If any of these work I have found in the Size Reports that over 40k is being eaten up by the AS3 Class. This is a major problem for all of us working with a 40~50k file size cap. Is there any way around this?

squadjot
September 27th, 2010, 11:02 AM
hello all.
question... very basic. (sorry)
for clickTags.. do i not need to also add my URL somewhere??
is that done in the html that embeds the ad?

No you should not..

The whole point is that the media can control the landingpage of the banner.

darklow
January 17th, 2011, 01:38 PM
If anyone looking for a correct clicktag and still have problems or even if you lost your .FLA, and need to put an clicktag on existing SWF, you can try this: http://getclicktag.com