Highlighted

Change image from instance by clicking

Community Beginner ,
Apr 30, 2019

Copy link to clipboard

Copied

Hello

How can I do to change the image of the current instance to another image that is in the library by clicking the mouse?

This is my code that in addition to playing a sound also changed the image:

###########################

var music: Boolean = true;

button_1.addEventListener(MouseEvent.CLICK, fl_MouseClickHandler_2);

function fl_MouseClickHandler_2(event: MouseEvent): void {

var Som: som_classe = new som_classe();

if (music == false) {

     SoundMixer.stopAll();

     musica = true;

}

else {

     Som.play();

     music = false;

}

#######################################

}

Thank you

Paulo Valentim

Adobe Community Professional
Correct answer by resdesign | Adobe Community Professional

You will need to have a movieclip in the library with a link name if you want to do that or you could load images from a folder

in which case see this thread:

Load dynamic external image in animate cc canvas/javascript

Views

84

Likes

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

Change image from instance by clicking

Community Beginner ,
Apr 30, 2019

Copy link to clipboard

Copied

Hello

How can I do to change the image of the current instance to another image that is in the library by clicking the mouse?

This is my code that in addition to playing a sound also changed the image:

###########################

var music: Boolean = true;

button_1.addEventListener(MouseEvent.CLICK, fl_MouseClickHandler_2);

function fl_MouseClickHandler_2(event: MouseEvent): void {

var Som: som_classe = new som_classe();

if (music == false) {

     SoundMixer.stopAll();

     musica = true;

}

else {

     Som.play();

     music = false;

}

#######################################

}

Thank you

Paulo Valentim

Adobe Community Professional
Correct answer by resdesign | Adobe Community Professional

You will need to have a movieclip in the library with a link name if you want to do that or you could load images from a folder

in which case see this thread:

Load dynamic external image in animate cc canvas/javascript

Views

85

Likes

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
Apr 30, 2019 0
Adobe Community Professional ,
Apr 30, 2019

Copy link to clipboard

Copied

With the instance selected, go to the Properties panel and to the right of "Instance of," click the button "Swap..." Animate will open a dialog that lists other symbols in your library. Select the one you want to replace the current symbol.

Likes

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
Reply
Loading...
Apr 30, 2019 0
Community Beginner ,
Apr 30, 2019

Copy link to clipboard

Copied

Hello Myra Ferguson.

Thanks for the reply but I want to do this using action script.

Likes

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
Reply
Loading...
Apr 30, 2019 0
Adobe Community Professional ,
Apr 30, 2019

Copy link to clipboard

Copied

You will need to have a movieclip in the library with a link name if you want to do that or you could load images from a folder

in which case see this thread:

Load dynamic external image in animate cc canvas/javascript

Likes

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
Reply
Loading...
Apr 30, 2019 0