Skip to main content
Participating Frequently
Nov 13, 2017 7:39 AM UTC
Answered

Changing color of a Movieclip with Javascript?

Hi,

I want to change the color of a Movieclip with a Mouse click. I have two areas. When I click on on one Area, the second should change in this color, wich I wrote in the Code.

But I don't know how to write this code in Javascript (please no answers in HTML)...

I should be able to write the color in hexadecimal.
Please can someone help me.. It's very important.

Thank you

This topic is closed to new replies. Start a new post to keep the conversation going.
kglad
kgladCorrect answer
Community Expert
Nov 13, 2017 3:07 PM UTC

in your click listener (if you bind(this)), you can use (if you want blue):

this.your_movieclip.shape.graphics._fill.style = "#0000FF";

21 replies

kglad
Community Expert
kgladCommunity ExpertCorrect answer
Community Expert
Nov 13, 2017 3:07 PM UTC

in your click listener (if you bind(this)), you can use (if you want blue):

this.your_movieclip.shape.graphics._fill.style = "#0000FF";

Translate
Participating Frequently
Nov 14, 2017 7:38 AM UTC

The code does not work

I have this code:

this.Marine_2.addEventListener("click", fl_MouseClickHandler_8.bind(this));

function fl_MouseClickHandler_8()

{

this.flaeche2.shape.graphics._fill.style = "#0000FF";

}

Is this wrong? what do I have to do?

Translate
kglad
Community Expert
Community Expert
Nov 14, 2017 2:40 PM UTC

one (or both) of your objects are not defined.  use the console to see where you made the error.

Translate