Skip to main content
Participating Frequently
November 13, 2017
Answered

Changing color of a Movieclip with Javascript?

  • November 13, 2017
  • 1 reply
  • 4083 views

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 has been closed for replies.
Correct answer kglad

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

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

1 reply

kglad
Community Expert
kgladCommunity ExpertCorrect answer
Community Expert
November 13, 2017

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

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

Participating Frequently
November 14, 2017

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?

kglad
Community Expert
Community Expert
November 14, 2017

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