Apparent Global play(); override
I'm experimenting with HTML canvas for the first time today. I want to compose self-contained excerpts of my larger animated lessons. To define my current difficulty I need to provide a brief description of how these lessons are formated. They are stop action progressions through the timeline. The playback progresses until it reaches a specified keyframe, where it stops. I refer to these specified keyframes as freezeFrames. After the playback stops at a freezeFrame, the user clicks the stage to get it to resume and progress to the next freezeFrame. Moreover, there is a back button at each freezeFrame. If the user clicks the back button the playback goes to the previous freezeFrame and stops there. Now I've found the code to do most of this (listed below), with one problem.
1.) Stops playback at a freezeFrame, written into a keyframe at the freezeFrame.
this.stop();
2.) Resumes playback when the stage is clicked, written into the first keyframe of the timeline.
var _this = this;
_this.stage.on("click", function(){
_this.play();
});
3.) Back buttons, written into a keyframe where the button first appears.
var _this = this;
_this.buttonLabel.on('click', function(){
_this.gotoAndStop("frameLable");
});
Now I can explain my problem. When I click a back button it doesn't obey the stop commands. It goes to the previous freezeFrame, but it doesn’t stop there. Instead, it plays back to the current freezeFrame.
To test the problem, I deleted code 2.) above. This eliminated the problem in that the playback would goto the previous freezeFrame and stop there as it's supposed to. Of course this doesn't allow the user to resume playback by clicking the stage. My interpretation is that the stage onClick play commands are overriding the stop commands.
I also tried writing the stage onClick play code into the global script instead of the first keyframe of the timeline, but it simply didn't work. The playback wouldn’t resume when the stage was clicked.
If someone could help this poor novice I would really appreciate it. How do I get a back button to send the playback to the previous freezeFrame and stop there, while still resuming playback when the stage is clicked?
