Skip to main content
Akenekiart
Participant
Nov 16, 2022 12:33 PM UTC
Question

Javascript change color button after press it

Hi.

Is it possible to use Javascript code to change the color of the button (button not movie clip object) after pressing it?
this is my code: 

const goodElements = [this.mc1_1, this.mc2_1] //buttons good
const wrongElements = [this.mc1_2, this.mc2_2] //buttons wrong

const Comparison = [...goodElements, ...wrongElements]

goodElements.forEach((element, index) => {
	element.addEventListener('click', () =>{
		points++

		//element.gotoAndStop(1);
		element.mouseEnabled=false;
		exportRoot.stworek.gotoAndPlay("good1");
		exportRoot.goodAnswer.play();
		nextFrame();
	});
})

 Thank you!

This topic is closed to new replies. Start a new post to keep the conversation going.

1 reply

kglad
Community Expert
Community Expert
Nov 16, 2022 4:14 PM UTC

element.shape.graphics._fill.style = "#ff0000"; // red

Translate