Skip to main content
Participating Frequently
November 13, 2017
解決済み

Changing color of a Movieclip with Javascript?

  • November 13, 2017
  • 返信数 1.
  • 4087 ビュー

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

このトピックへの返信は締め切られました。
解決に役立った回答 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

kglad
Community Expert
kgladCommunity Expert解決!
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.