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

Adding multiple clickTags in AS3

Community Beginner ,
Jan 25, 2012 Jan 25, 2012

Copy link to clipboard

Copied

Hi -

I just started recently using more of AS3.  All of our previous banners were in AS2 (before my time here) so I just continued to work within that.  I am on a Mac and using Flash 5.5.

However, I am now creating some new banners in AS3 from scratch.  There are 6 total clickTags on the banner that we track.  There is an invisible button over the entire banner that stays on there to a specific keyframe and has a clickTag.  Then, at the very end there are 5 text buttons each with a clickTag.

When I test it in Flash 5.5 it plays fine but gives me the following warning under the Output tab:

***WARNING: Actions on button or MovieClip instances are not supported in ActionScript 3.0. All scripts on object instances will be ignored.***

Can anyone give me some guidance on this?  I have done some research and keep seeing that I need to place the actions on separate keyframes.  What code do I use and does each clickTag need to be on it's own keyframe?

Below is the general clickTag code we have been using but the banners are in AS2.

on (release) {

    getURL(_level0.clickTag2, '_blank');

}

Many thanks. 

TOPICS
ActionScript

Views

3.0K

Translate

Translate

Report

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 ,
Jan 25, 2012 Jan 25, 2012

Copy link to clipboard

Copied

What code are you using for AS3?  All code must go in the timeline (or a separate .as file) in AS3 designs.  The code for any buttons should be placed in frames where the buttons that the code targets are present.  If you start seeing 1009 errors you'll know that your code is trying the target objects that are not present when the code executes.

Votes

Translate

Translate

Report

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
Community Beginner ,
Jan 25, 2012 Jan 25, 2012

Copy link to clipboard

Copied

Thanks for your response Ned 🙂

I am using a component called Flasheff to make some of our text animation more complex but quicker to create.  Flasheff requires you to use AS3.  This is why I am now having some issues with the previous clickTag code we were using on our AS2 banners.

The only code I have put into Actions is the clickTag (code is in my original message) and this has been placed on each text button.  Then, someone in our department plugs everything into a Google ad tracking system. 

I am now just trying to figure out how to use multiple clickTags if I cannot place them on the frame of each button. 

I hope that this helps to explain a bit better.  I wish I could post the FLA file but I cannot due to confidentiality of the company I work for.

Thanks again!!

Votes

Translate

Translate

Report

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 ,
Jan 25, 2012 Jan 25, 2012

Copy link to clipboard

Copied

Since you said you were using AS3, but showed AS2 code, I assumed you had the AS3 code somewhere.  I guess you have no experience coding buttons with AS3 so here's a little cut and paste from my forum help file....

Let's say you create a button symbol.  Since it is a button, it is already a self animating object that will react to mouse interactions, but only visually at this stage.  The first thing you need to do to make it useful code-wise is to assign it a unique instance name.  So you drag a copy of it out to the stage from the library, and while it's still selected, you enter that unique instance name for it in the Properties panel... let's say you name it "btn1"


In AS3, to make a button work with code, you need to add an event listener and event handler function for it.  You might need to add a few (for different events, like rollover, rollout, clicking it, but for now we'll just say you want to be able to click it to get a web page to open.  In the timeline that holds that button, in a separate actions layer that you create, in a frame numbered the same as where that button exists, you would add the event listener:


btn1.addEventListener(MouseEvent.CLICK, btn1Click);

The name of the unique function for processing the clicking of that button is specified at the end of the event listener assignment, so now you just have to write that function out:


function btn1Click(evt:MouseEvent):void {

   var url:String = "http://www.awebsite.com/awebpage.html";

   var req:URLRequest = new URLRequest(url);

   navigateToURL(req);

}


Here's some of what's involved there:


evt:MouseEvent - the event listeners throws an argument automatically which the function must be set up to receive.  In this case I have given that argument a variable name of evt, though I could have chosen anything.


:void - this defines the class of the value that the function will return.  In this case, the function does not return anything, so "void" is used.  If it did return a value, you would see a line containing "return xyz"; in the function (where xyz is not literal, it simply represents the variable or value being returned)


The normal code to open a web page contains three distinct elements, the url, the request, and the command to get the page, so I have shown them as three separate lines.  Many people will combine them into one line.

     navigateToURL(new URLRequest("http://www.whatever.com"));

If you have more questions about the navigateToURL() function, have a look in the help documentation.

Votes

Translate

Translate

Report

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
Community Beginner ,
Jan 25, 2012 Jan 25, 2012

Copy link to clipboard

Copied

LATEST

Thanks Ned.  I finally resolved the issue.  I appreciate all your help.

Votes

Translate

Translate

Report

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