Copy link to clipboard
Copied
I'm having a problem with some buttons on animate. The HTML is correct and the button has an instance name. I can go to the next frame or the frame after if I change the code but not the frame I need to go to. The rest of the buttons work perfectly, this is the only problematic one. The output mentions content using bitmap and buttons may cause errors but I've moved all of the buttons from these frames to new frames so I don't think it's that. Any ideas?
Hi.
You have three functions with the same name in the first image. Give them different names.
Regards,
JC
Copy link to clipboard
Copied
Hi.
You have three functions with the same name in the first image. Give them different names.
Regards,
JC
Copy link to clipboard
Copied
Okay, perfect, thank you! I need to ask though, what do I actually need to change? I'm a complete novice . The this. lines of code?
Copy link to clipboard
Copied
It seems you first image disappeared.
Anyway, following your approach, a practical and safe way would be like this:
function gotoFrame0(e)
{
this.gotoAndStop(0);
}
function gotoFrame1(e)
{
this.gotoAndStop(1);
}
function gotoFrame2(e)
{
this.gotoAndStop(2);
}
if (!this.frame0Started) // this check is to prevent the buttons from receiving multiple listeners
{
this.stop();
this.button0.addEventListener("click", gotoFrame0.bind(this));
this.button1.addEventListener("click", gotoFrame1.bind(this));
this.button2.addEventListener("click", gotoFrame2.bind(this));
this.frame0Started = true;
}
Each button gets a different handler function.
Regards,
JC
Copy link to clipboard
Copied
Ha ha! The missing first image now explains a lot!
I thought "I know João is really good... but I didn't know he was THIS good!!!" as I couldn't see the 3 functions in the first (now gone) image!!!
Copy link to clipboard
Copied
HAHAHAHAHAHA!
And I wish I was THIS good!