Skip to main content
Inspiring
January 8, 2008
Question

ClickTag

  • January 8, 2008
  • 3 replies
  • 689 views
It work for some old banners, but not with AS.
Am I missing something?

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

Thanks Brian
This topic has been closed for replies.

3 replies

Damon Edwards
Inspiring
January 30, 2008
var clickTAG:String = loaderInfo.parameters.clickTAG;

tagButton.addEventListener(MouseEvent.CLICK, fireTag);
function fireTag(e:MouseEvent):void {
var request:URLRequest = new URLRequest(clickTAG);
navigateToURL(request, "_blank");
}



The actual value of 'clickTAG' will be passed in through FlashVars

January 9, 2008
Give your button an instance name. In this example, I have named my button "tagButton".

Then add this code to the timeline:
Participant
January 25, 2008
I used the code suggested, and yet this isn't working. I have a button called tagButton, and I put the code into the top level timeline, and I get four compilation errors:

Access of undefined property clickTAG
call to possibly undefined method getURL
Access of undefined property clickTag
Access of undefined property tagButton

Any suggestions? This seems to be so easy; I don't know why I can't get it to work.
January 25, 2008
Oops!...Sorry about that...I was so focused on showing you what a listener does that I didn't even consider the rest of your code. You have to declare your variables in AS3. It is very strict. Also, getURL no longer exists. Try this:

Inspiring
January 8, 2008
You can't attach a piece of code directly to a button in AS3. You have to add a listener to the button and run the code from that.

- B