• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

load a movieclip html5 canvas

Community Beginner ,
Dec 10, 2017 Dec 10, 2017

Copy link to clipboard

Copied

How to display a movieclip when button is clicked in animate cc (canvas html5).

I hope someone can help me. thanks.

Views

5.6K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Dec 11, 2017 Dec 11, 2017

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.b

...

Votes

Translate

Translate
Community Expert ,
Dec 11, 2017 Dec 11, 2017

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 12, 2021 Mar 12, 2021

Copy link to clipboard

Copied

LATEST

Hi,

Is there anyway to load dynamic symbol from library?

I created different linkage names for sybmols and would need to load one of them each time according to the button event I click. Then I need to scroll the dynamically loaded movieClip within certain area on the stage.

 

Thanks in advance

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Dec 11, 2017 Dec 11, 2017

Copy link to clipboard

Copied

ok! its work. thank you very much.

but, how to set an movieclip potition on stage if to fit as my wish?

thanks for your help.

how to set the movie clip layout in stage

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 11, 2017 Dec 11, 2017

Copy link to clipboard

Copied

This is great!

Like this:

var that = this;

this.buttonVisible.addEventListener("click", makeVisible);

this.buttonAdd.addEventListener("click", addFromLibrary);

function makeVisible(e)

{

    that.mc.x = 400;   

    that.mc.y = 100;   

    that.mc.visible = true;

}

function addFromLibrary(e)

{

    // store the object in a variable

    var rec = new lib.Rectangle();

    rec.x = 150;

    rec.y = 250;

    that.addChild(rec);

   

    // or add directly

    //that.addChild(new lib.Rectangle());

}

Please don't hesitate to ask if you have any further questions.

Regards,

JC

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Dec 11, 2017 Dec 11, 2017

Copy link to clipboard

Copied

one more problem, how to unload movie clip in different timeline?

sorry for my questions. I just learn to adobe animate (html5 canvas).

Thanks

god bless you

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 11, 2017 Dec 11, 2017

Copy link to clipboard

Copied

What do you mean in different timeline?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Dec 11, 2017 Dec 11, 2017

Copy link to clipboard

Copied

how unload movie clip is not in current timeline?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 11, 2017 Dec 11, 2017

Copy link to clipboard

Copied

Do you mean timelines of other symbols? Like a Movie Clip inside another Movie Clip, a button inside of another Movie Clip, and so on?

If it is, you can use dot notation and call the method removeChild.

Let's say in our example we add another Movie Clip inside 'mc' called 'childMc'. And we add a button called 'buttonRemoveChild' just to remove the 'childMc'. Our code will be:

var that = this;

this.buttonRemoveChild.addEventListener("click", removeChild);

function removeChild()

{

    that.mc.removeChild(that.mc.childMc);

}

Notice that the methods addChild and removeChild have to be called by the parent.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Dec 11, 2017 Dec 11, 2017

Copy link to clipboard

Copied

can you give me a example project JoãoCésar​? thanks very much

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 12, 2017 Dec 12, 2017

Copy link to clipboard

Copied

Sure.

Here we go: show_add_movie_clips_html5.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Dec 12, 2017 Dec 12, 2017

Copy link to clipboard

Copied

ok. thanks, but i cant open it. i use animate cc 2017. how can fix trouble?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 12, 2017 Dec 12, 2017

Copy link to clipboard

Copied

Animate CC won't let me save an FLA to older versions.

What I can do is to save as a .xfl and you try to open and see if it works: show_add_movie_clips_html5_xfl.

Anyway, the best you can do is to open the Adobe Creative Cloud app and upgrade your Animate 2017 to the 2018 version and then your are going to be able to open the file, besides getting lot of bug fixes and some new cool features.

Regards,

JC

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Dec 12, 2017 Dec 12, 2017

Copy link to clipboard

Copied

hi, JoãoCésar​ now im use animate cc 2018. but your file  show_add_movie_clips_html5​ still can't open it. any solution for me?

thanks

Regards

Chanz

https://goo.gl/xbaU82

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 13, 2017 Dec 13, 2017

Copy link to clipboard

Copied

Hi again.

Are you trying to open the .zip file in Animate or the .fla inside the .zip file?

You have to first extract the .zip file and then run the .fla.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Aug 22, 2018 Aug 22, 2018

Copy link to clipboard

Copied

Is there a way to load these movieclips on layers, i made different scripts on different layers but the last loaded movieclip is always in front of the other and i want to preserve the layers,

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines