Copy link to clipboard
Copied
Boy, for some reason this is continuing to be problematic. I've looked it up in several places and tried all the code variations and still I am unable to add a working link to a button in an expanding Flash ad.
Here is the latest code I've been using (where 'product1' is a button in movie clip 'trafficClip')
import flash.net.navigateToURL;
import flash.net.URLRequest;
import flash.net.URLRequestMethod;
import flash.events.MouseEvent;
trafficClip.product1.addEventListener(
MouseEvent.CLICK, myButtonFunction);
function myButtonFunction(event:MouseEvent):void {
var request:URLRequest = new URLRequest("http:/myurlhere.html");
navigateToURL(request, "_self");
}
When I publish, I get the hand over the button but when I click it just goes back to the beginning of the process (collapsed ad).
Also, when I publish I am also still getting a 'textlayout.swc does not resolve to valid file' even though there are no text fields in the piece.
Any ideas? Thanks in advance.
Copy link to clipboard
Copied
There is nothing wrong with that code, although if you have the first line split into two the way it shows in your posting it is best to keep it one line....
trafficClip.product1.addEventListener(MouseEvent.CLICK, myButtonFunction);
The problem likely lies elsewhere. If this is an expanding ad then is there other code dedicated to that functionality?
Copy link to clipboard
Copied
Thanks Ned. So I wasn't losing my mind. I finally started from scratch instead of using their template which they have you add that code to and it appears to work now. So you're right something must have been messed up with their template. Thanks for responding.
Copy link to clipboard
Copied
You're welcome
Find more inspiration, events, and resources on the new Adobe Community
Explore Now