HTML5 MC Click = Move Root Timeline Forward 5 Frames or Back 5 Frames = Random 10 to 20 Frame Jump?
I made two movie clips so that where ever they are placed on a timeline, when clicked one would move the root forward and the other would move the root backward by 5 frames. For some odd reason I can't account for, sometimes the movie clip would jump 20 frames - as if the specified frame number value were being added.
See video for this odd, buggy behavior in action:
The code I am using for the Forward Movie Clip that contains a Button is:
this.p_Next.removeAllEventListeners("click");
Jump5 = 0; // my attempt to clear any previous value that may be adding up somewhere that could account for the clip jumping more than the 5 frames indicated next:
Jump5 = exportRoot.timeline.position+5;
function Next5(){
this.parent.gotoAndStop(Jump5);
this.gotoAndPlay(0); // This is a 2 frame MC, the first frame contains the "removeAllEventListeners" above.
}
this.p_Next.addEventListener("click", Next5.bind(this));
this.stop();
For the Reverse MC, the code is nearly identical:
this.p_Prev.removeAllEventListeners("click");
Back5 = 0;
Back5 = exportRoot.timeline.position-5;
function Prev5(){
this.parent.gotoAndStop(Back5);
this.gotoAndPlay(0);
}
this.p_Prev.addEventListener("click", Prev5.bind(this));
this.stop();
Shouldn'ty this work perfectly? Is there something I am over looking?
Is there a better way to do this?
Any helpful insight would be greatly appreciated, thank you.
