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
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
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");
}
Perfect. It works.
Thank you for your help.
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
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
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");
}
Copy link to clipboard
Copied
Perfect. It works.
Thank you for your help.
Copy link to clipboard
Copied
You're welcome.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now