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

gotoAndPlay MovieClip

Contributor ,
Nov 27, 2016 Nov 27, 2016

Copy link to clipboard

Copied

I have a button on the top layer of my Adobe Animate CC 2017 Canvas file the instance name is "btn_Button01". I have this ClickTag code which is working on the Actions layer:

this.btn_Button01.addEventListener("click", fl_ClickToGoToWebPage);

function fl_ClickToGoToWebPage() {

  window.open(window.clickTag);

}

Further down the timeline, a movieclip with an instance name "btn_Button02" fades in UNDER the button. I want to move the playhead of the movieclip when the button is rolled over. So, rollover btn_Button01 and btn_Button02 will gotoAndPlay "over". I have tried this code but it is not working. I am not sure the proper syntax to control the playhead of a movieclip when a button is rolled over. Any help would be appreciated.

stage.enableMouseOver;

this.btn_Button01.addEventListener("mouseover", fl_MouseOverHandler.bind(this));

this.btn_Button01.addEventListener("mouseout", fl_MouseOutHandler.bind(this));

function fl_MouseOverHandler()

{

  this.btn_Button02.gotoAndPlay("over");

}

function fl_MouseOutHandler()

{

  this.btn_Button02.gotoAndPlay("off");

}

TOPICS
Ad development

Views

4.3K

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

correct answers 1 Correct answer

Advocate , Nov 28, 2016 Nov 28, 2016

Yes, I looked at your Fla; that's how I know that you don't have an instance name on both keyframes.

You have an instance name on frame 164, but not frame 151.  You need to have a matching instance name on both keyframes.

Votes

Translate

Translate
Advocate ,
Nov 27, 2016 Nov 27, 2016

Copy link to clipboard

Copied

For this to work, you need to add frame labels for the"over" and "off" animation frames.  Here is some basic information about frame labels: Use frames and keyframes in Adobe Animate CC

You also need parenthesis in stage.enableMouseOver();but if you have any button symbols you don't actually need to include enableMouseOver at all, because it will be automatically generated in the HTML.

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
Contributor ,
Nov 28, 2016 Nov 28, 2016

Copy link to clipboard

Copied

I am using frame labels. I added the parenthesis but the problem persists. This would work fine with ActionScript. Having trouble getting used to this new scripting syntax. The banner ad needs to be HTML5.

So just to be clear, I am rolling over a button. When rolled over, I want to gotoAndPlay a label of another movieclip on the main timeline that is beneath the button layer.

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
Advocate ,
Nov 28, 2016 Nov 28, 2016

Copy link to clipboard

Copied

Yes.  The syntax is fine and should work as you described. 

If you're still experiencing issues, please share a copy of your Fla file using Box, Dropbox, Google Drive, or something similar to make troubleshooting easier.

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
Contributor ,
Nov 28, 2016 Nov 28, 2016

Copy link to clipboard

Copied

Here's and .fla file. Not the actual file, but the parts that are the issue.

Dropbox - Test_160x600.fla.zip

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
Advocate ,
Nov 28, 2016 Nov 28, 2016

Copy link to clipboard

Copied

The code that you original posted in this thread was fine.  It should still be:

this.btn_Button01.addEventListener("mouseover", fl_MouseOverHandler.bind(this));

this.btn_Button01.addEventListener("mouseout", fl_MouseOutHandler.bind(this));

Not what's currently in your file:

this.btn_Button01.addEventListener("mouseover", fl_MouseOverHandler.bind(this.btn_Button02));

this.btn_Button01.addEventListener("mouseout", fl_MouseOutHandler.bind(this.btn_Button02));

You also need to have an instance name on both keyframes of your button in the main timeline.

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
Contributor ,
Nov 28, 2016 Nov 28, 2016

Copy link to clipboard

Copied

When I use the code in green, it doesn't work. Not in my actual banner or the test one I shared. When I click CMD-Return to view the animation.

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
Advocate ,
Nov 28, 2016 Nov 28, 2016

Copy link to clipboard

Copied

You also need to have an instance name on both keyframes of the button symbol on the main timeline.  That was your other problem.

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
Contributor ,
Nov 28, 2016 Nov 28, 2016

Copy link to clipboard

Copied

I do have instance names on the keyframes. Have you looked at my .fla?

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
Advocate ,
Nov 28, 2016 Nov 28, 2016

Copy link to clipboard

Copied

Yes, I looked at your Fla; that's how I know that you don't have an instance name on both keyframes.

You have an instance name on frame 164, but not frame 151.  You need to have a matching instance name on both keyframes.

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
Contributor ,
Nov 28, 2016 Nov 28, 2016

Copy link to clipboard

Copied

LATEST

Okay that did the trick. THANK YOU!

It's been awhile since I've used the timeline for tweening. I have literally programmed thousands of SWF banners. Mostly using AS for the animations. Pretty new to the HTML5 banner world. Taught myself Edge Animate and was doing banners in there, only to have it discontinued. Glad to be back in Flash. Just have to dust off my old timeline skills.

It thought that since the Action didn't show up till 164, that is the only place I needed to do the instance name, not before.

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