load a movieclip html5 canvas
How to display a movieclip when button is clicked in animate cc (canvas html5).
I hope someone can help me. thanks.
How to display a movieclip when button is clicked in animate cc (canvas html5).
I hope someone can help me. thanks.
Hi.
Two ways of doing this is making the Movie Clip visible or adding from the library. It depends on what you want.
Assuming that you have a Movie Clip on the stage called 'mc' that has its visible property unchecked in the Properties panel and it has a linkage name of "Rectangle" in the Library panel. And you also have two buttons called 'buttonVisble' and 'buttonAdd' on the stage, add this code to the main timeline:
var that = this;
this.buttonVisible.addEventListener("click", makeVisible);
this.buttonAdd.addEventListener("click", addFromLibrary);
function makeVisible(e)
{
that.mc.visible = true;
}
function addFromLibrary(e)
{
that.addChild(new lib.Rectangle());
}
Working example: here.
Regards,
JC
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.