Copy link to clipboard
Copied
New to Flash Professional and ActionScript3 so please bare with me. Tried to insert a ClickTag the way you would in AS2 and it doesn't work.
This is is the code I need to put in, but I am not sure how to get it to work:
import flash.events.MouseEvent;
import flash.net.URLRequest;
// ......
someButton_or_displayObject_to_receive_mouseClick.addEventListener(
MouseEvent.CLICK,
function(event: MouseEvent) : void {
flash.net.navigateToURL(new URLRequest( root.loaderInfo.parameters.clickTAG), "_blank");
}
);
Also, do I need to put the Stop Action in the same layer or can in be in a separate layer?
Thanks!
Copy link to clipboard
Copied
You need to be testing with the html page in case you aren't.
Separate the function from the listener and see if you get better results...
someButton_or_displayObject_to_receive_mouseClick.addEventListener(MouseEvent.CLICK, clickedBtn);
function clickedBtn(event: MouseEvent) : void {
flash.net.navigateToURL(new URLRequest( root.loaderInfo.parameters.clickTAG), "_blank");
}
If that doesn't help, add a textfield temporarily and assign it the value of the clickTag to make sure it is being read properly
It is okay to put the stop() in the same layer
Copy link to clipboard
Copied
Hi Ned,
I've been uploading to Double Click by Google and testing the .swf files there with no success. I don't think I am doing the correct steps in Flash to make the click tag work. I found a tutorial and followed these steps with no luck...
1. Created a box over the ad using a rectangular primitive tool and changed the alpha to 0%.
2. Converted it to a button and named it someButton
3. Opened Actions > Event Handlers > Mouse Click Event
4. Put the above code in after the generated code:
button_3.addEventListener(MouseEvent.CLICK, fl_MouseClickHandler_3);
function fl_MouseClickHandler_3(event:MouseEvent):void
{
someButton_or_displayObject_to_receive_mouseClick.addEventListener(Mou seEvent.CLICK, clickedBtn);
function clickedBtn(event: MouseEvent) : void {
flash.net.navigateToURL(new URLRequest( root.loaderInfo.parameters.clickTAG), "_blank");
}
5. Exported and tested in Double Click.
I got these directions from a tutorial and they don't seem to work. Do you see anything I might be doing wrong?
Thanks for your help!
Lindsay
Copy link to clipboard
Copied
You are coding for two buttons and I do not see the sense in it. Clicking button3 only serves to add clicking functionality to something named "someButton_or_displayObject_to_receive_mouseClick" but you say you named your button "someButton" The code needs to target the button using the name you used for the button. If your button is named someButton, then the following is all the code you should need...
someButton.addEventListener(Mou seEvent.CLICK, clickedBtn);
function clickedBtn(event: MouseEvent) : void {
flash.net.navigateToURL(new URLRequest( root.loaderInfo.parameters.clickTAG), "_blank");
}
... and "someButton" is assigned via the Properties panel... it is not the name of the object in the library.
You appear to have the second function nested within the first function... get it out of there and let it stand on its own.
You also need to make sure your html page defines the clickTag parameter.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now