• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Javascript change color button after press it

Community Beginner ,
Nov 16, 2022 Nov 16, 2022

Copy link to clipboard

Copied

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!

TOPICS
Code , How to

Views

258

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
community guidelines
Community Expert ,
Nov 16, 2022 Nov 16, 2022

Copy link to clipboard

Copied

LATEST

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

Votes

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
community guidelines