Buttons for Canvas - activating a movie clip w/ a button


i'm trying play movie clip object using button.  don't know syntax necessary this.

 

the scenario there 10 buttons on page, designated button objects (4 frames, over/down/up/hitbox) , 10 movie clip objects (with multiple frames).  these on same stage.  want code button1 play movieclip1.  in old actionscript, seems easy.  have no idea how in canvas.  every time try put in code snippets, entire thing (background, everything) breaks.

 

the general logic looks this

 

on button1 press, play movieclip1

on button2 press, play movieclip2

 

etc.

for(var i=1;i<=10;i++){

this['button'+i].addeventlistener('mousedown',f);

}

function f(e){

var mc_num=e.currenttarget.name.split('button')[1];

this['movieclip'+mc_num].play();

}



More discussions in Adobe Animate CC - General


adobe

Comments

Popular posts from this blog

Illustrator CS6 Ocurrío un error E/S en el archivo.

Why is os_ViewContainer running?

Animate - problem with duplicating scripts after loop