Answered
Having issue with accumulative event listeners for frame navigation.
Hey guys! I'm new and I'm having issues with my frame navigation.
My issue is that after a few times going back and forth using the navigation buttons I have created the behavior of the buttons start to become slow. The more I do it the longer it takes.
I read here that event listeners are accumulative and that I should remove the event listeners. I have tried this but when I remove the event listeners my buttons stop working.
This is the original code accumulating the events listeners.
this.btn_back.addEventListener("click", fl_ClickToGoToAndStopAtFrame);
function fl_ClickToGoToAndStopAtFrame()
{
root.gotoAndStop(0);
}
this.btn_next.addEventListener("click", fl_ClickToGoToAndStopAtFrame_2);
function fl_ClickToGoToAndStopAtFrame_2()
{
root.gotoAndStop(2);
}
My question is, where should I put the removeEventListeners? I have to use these buttons all over the project and it is not necessarally sequential navigation.
I really appreciate your help guys.
My question is, where should I put the removeEventListeners? I have to use these buttons all over the project and it is not necessarally sequential navigation.
I really appreciate your help guys.
