Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Add link in AS3

Explorer ,
Jun 18, 2014 Jun 18, 2014

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.

TOPICS
ActionScript
331
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 18, 2014 Jun 18, 2014

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?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 18, 2014 Jun 18, 2014

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 18, 2014 Jun 18, 2014
LATEST

You're welcome

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines