Animate cc canvas movie clip button.
Hello everyone on the forum.
Maybe someone will guide me on how to solve this problem in adobe animate cc canwas.
In AS 3 the button works fine, but in javaScript I tried different ways and can't do it.
This is AS 3 code
var x:Boolean = false;
this.info_btn.addEventListener(MouseEvent.CLICK, onClick);
this.info_btn.addEventListener(Event.ENTER_FRAME, animate);
function onClick(e: MouseEvent):void {
if (x) {
x = true;
} else {
x = false;
my_mc.play();
}
}
function animate(e: Event): void {
if (!x && my_mc.currentFrame == my_mc.totalFrames - 46) {
my_mc.stop();
}
}
MovieClip starts from the current frame and stops at 47 frames from the end, and so on with each click.
below code but can't get it sorted
//var x = false;
//let x = false;
x = Boolean(false);
this.info_btn.addEventListener('click', onClick);
function onClick() {
if (x) {
x = true;
console.log('pause');
} else {
x = false;
root.my_mc.play();
console.log('happy');
}
}
If anyone guides me, thank you.
