Skip navigation
jeffht681
Currently Being Moderated

Newbie to Flash - need help with creating a click tag banner

May 23, 2013 8:00 PM

Hi all. Completely new to Flash - have Flash CS6.

 

I have successfully created an ad banner with an embedded link. Now, I need to take the same ad banner and create a clicktag. The code I have used for the "embedded" banner is the following:

 

import flash.events.MouseEvent;

import flash.net.URLRequest;

circle.addEventListener(MouseEvent.CLICK, clickcircle);

function clickcircle (event:MouseEvent):void {

    var myURL:URLRequest = new URLRequest ("http://www.url.com");

    navigateToURL (myURL);
}

 

As I stated, that works great.

 

I have been told by the owner of the site where the clicktag banner will be going, to use the following code:

 

   on (release) {

          if (clickTAG.substr(0,5) == "http://www.url.com") {

              getURL(clickTAG, "_blank");

          }

      }

 

But that doesn't seem to worl. I can export the banner, but if I click on it, it doesn't bring me anywhere. So, I guess the first Q is - is that the entire code I need? Or do I incorporate that somehow to the old code I had?

 

I was driven to this page:

 

http://support.google.com/dfp_sb/bin/answer.py?hl=en&topic=13160&answe r=79268

 

But that's not really helping me - I guess b/c I am so new this that I dont really undertand all of that.

 

So, I was hoping someone would be kind enough to help me out here.

 

Thanks in advance.

 
Replies
  • kglad
    72,227 posts
    Jul 21, 2002
    Currently Being Moderated
    May 23, 2013 10:13 PM   in reply to jeffht681

    if clickTAG is defined, use:

     

    import flash.events.MouseEvent;

    import flash.net.URLRequest;

    circle.addEventListener(MouseEvent.CLICK, clickcircle);

    function clickcircle (event:MouseEvent):void {


       if (clickTAG.substr(0,5) == "http://www.url.com") {  //<-this will never be true but it's the correct conversion of the code you showed.  you should probably use: if(clickTAG.indexOf("http://www.url.com")>-1){  instead of that substr() method.

        var myURL:URLRequest = new URLRequest ("http://www.url.com");

        navigateToURL (myURL);


    }

    }

     
    |
    Mark as:
  • kglad
    72,227 posts
    Jul 21, 2002
    Currently Being Moderated
    May 24, 2013 4:12 PM   in reply to jeffht681

    that's why i said, assuming clickTAG is defined.

     

    you need to know how to define it.  you won't be hard-coding it.  you're supposed to follow directions from your client about how to retrieve the value of clickTAG.

     

    my recollection is that you might be retrieving it using flashvars but you should check that.

     
    |
    Mark as:
  • Currently Being Moderated
    May 29, 2013 7:54 PM   in reply to kglad

    Thanks!

     

    Ok, so apparently, there really isnt much I need to do here, in terms of code and url - like I originally thought.

     

    Again, I have this:

     

    on (release) {

    if (clickTAG.substr(0,5) == "http://www.url.com") {

    getURL(clickTAG, "_blank");

    }

    }

     

     

    And apparently, the webmaster does the rest. Or at least, that's my understanding of it.

     

    Problem is, the banner is not a clickable url, and the cursor does nto change to a hand. The webmaster says

     

    1. I should  ensure that the button associated with the ActionScript that contains the clickTAG is on the top-most layer through the timeline, and

     

    2. The button associated with the ActionScript that contains the clickTAG is extended throughout the entire frame and is applied to all existing frames

     

    I am pretty sure all of the above is true - how do I check to make sure of all of this?

     

    p.s. - had a problem accessing my acct, so I created a new one with the added 'a'

     
    |
    Mark as:
  • kglad
    72,227 posts
    Jul 21, 2002
    Currently Being Moderated
    May 29, 2013 9:08 PM   in reply to jeffht681a

    are you supposed to use as2 or as3 and are you using the correct as version?

     
    |
    Mark as:
  • Currently Being Moderated
    May 30, 2013 8:21 AM   in reply to kglad

    I am using AS3. The webmaster sent me this:

     

    "Apparently the Flash or ActionScript version in the submitted SWF is not supported".

     

    That is an error he sees,  when he uploads the banner to Google dfp.

     

    Should I switch to AS2? I dont see how that would matter; I thought it's the code that matters, not what you tell Flash CW6 to use - no?

     

    Next approrpriate step to take woule be.... ?

     
    |
    Mark as:
  • kglad
    72,227 posts
    Jul 21, 2002
    Currently Being Moderated
    May 30, 2013 11:13 AM   in reply to jeffht681a

    if you're using as3 and that is not supported, you need to use as2.

     
    |
    Mark as:
  • kglad
    72,227 posts
    Jul 21, 2002
    Currently Being Moderated
    May 31, 2013 8:25 AM   in reply to jeffht681

    the flash player uses a publish setting to determine which virtual machine to use to interpret your code.  if you publish for as3 and have any as2 code (that's not compatible with as3), no code will work.  if you publish for as2 and have as3 code (that's not compatibile with as2), no code will work.

     

    click file>publish settings>script combobox>select actionscript 2.0

     

    the code you're showing in message 8, needs to be attached to a movieclip or button (which is a poor way to code).  no code should be attached to objects.

     

    you should assign your button or movieclip and instance name and use it in code attached to the timeline that contains your button or movieclip:

     

    yourbutton.onRelease=function(){

    if (clickTAG.substr(0,5) == ""http:") {

    getURL(clickTAG, "_blank");

    }

    }

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points