How to move to a specific frame in Adobe Animate?
I've published a HTML5 canvas project and am trying to rewind the timeline when it reaches a frame. This is what I'm trying:
From within the fnStartAnimation function:
stage.addEventListener("tick", handleTick)
handletick is defined as:
let pos = parseInt(stage.children[0].timeline.position);
if(pos === 44) {
stage.stop(40);
setTimeout(() => {
stage.play();
}, 2000);
}
The above code is a just an example. What I'm trying to do is once the timeline reaches frame 44, rewind to frame 40, wait 2 seconds and then restart the animation playback. It'd basically loop forever between frames 40 and 44.
If I do a console.log(pos) before the if statement, I can see that the timeline has been rewinded, but the animation playback continues to play where it was stopped (frame 44) and goes on until the end of the timeline.
I've also tried to manually set the timeline position like stage.children[0].timeline.setPosition(40) and stage.children[0].gotoAndPlay(40) with similar results.
Does anyone know what I am doing wrong? Why is the timeline position showing correctly but the animation isn't following along the timeline position?
