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

The link is not working. Animate and Canvas

Community Beginner ,
Feb 10, 2023 Feb 10, 2023

Copy link to clipboard

Copied

Hi

I have a movie clilp with 3 frames.

The first and the second are the choises selected.

The third one has 2 butons to select.

When I click on the mc, it goes to the third frame and display the options.

Then when I click in any option, I made changes (this works) and I want the movie click to return to the selected option, but this doesn't work

I have this code:

this.control_mc.addEventListener("click", control_1.bind(this));
function control_1() {

         this.control_mc.gotoAndStop("select"); //this is working with no problems

}

this.control_mc.manual_btn.addEventListener("click", manual_sel.bind(this));
function manual_sel() {
       this.control_mc.gotoAndStop("manual"); //Here I have few more lines that works as well, but the control_mc doesn't go to "manual"

}

 

Any idea?

Thank you

Views

230

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 3 Correct answers

Community Expert , Feb 10, 2023 Feb 10, 2023

Hi.

 

I think it's because the listener you added to control_mc fires after the event you added to manual_btn. In this way the container will always go to the "select" label.

 

One possible solution will be to stop event propagation in the listener will added to manual_btn so that when you click exactly on it, the parent (control_mc) won't be notified. Like this:

 

function manual_sel(e)
{
    e.stopPropagation();
    this.control_mc.gotoAndStop("manual");
}

 


I hope it helps.

 

Regards,

JC

Votes

Translate

Translate
Community Expert , Feb 10, 2023 Feb 10, 2023

It's a parameter of the function.

 

function manual_sel(e) // <-- the event object (in this case called e)
{
	e.stopPropagation();
	this.control_mc.gotoAndStop("manual");
}

 

Votes

Translate

Translate
Community Beginner , Feb 10, 2023 Feb 10, 2023

Perfect. It works.

Thank you for your help. 

 

Votes

Translate

Translate
Community Expert ,
Feb 10, 2023 Feb 10, 2023

Copy link to clipboard

Copied

Hi.

 

I think it's because the listener you added to control_mc fires after the event you added to manual_btn. In this way the container will always go to the "select" label.

 

One possible solution will be to stop event propagation in the listener will added to manual_btn so that when you click exactly on it, the parent (control_mc) won't be notified. Like this:

 

function manual_sel(e)
{
    e.stopPropagation();
    this.control_mc.gotoAndStop("manual");
}

 


I hope it helps.

 

Regards,

JC

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 ,
Feb 10, 2023 Feb 10, 2023

Copy link to clipboard

Copied

Thank you for the answer

I got "e is not deffined". I tested with "var e = event", but it doen't work either

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 Expert ,
Feb 10, 2023 Feb 10, 2023

Copy link to clipboard

Copied

It's a parameter of the function.

 

function manual_sel(e) // <-- the event object (in this case called e)
{
	e.stopPropagation();
	this.control_mc.gotoAndStop("manual");
}

 

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 ,
Feb 10, 2023 Feb 10, 2023

Copy link to clipboard

Copied

Perfect. It works.

Thank you for 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
Community Expert ,
Feb 10, 2023 Feb 10, 2023

Copy link to clipboard

Copied

LATEST

You're welcome.

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