Welcome Dialog

Welcome to the Community!

We have a brand new look! Take a tour with us and explore the latest updates on Adobe Support Community.


Button alternate colors

Explorer ,
Jun 16, 2021 Jun 16, 2021

Copy link to clipboard

Copied

Hi, I need help making my button field alternate between yellow and red when it's clicked. TIA

TOPICS
How to

Views

365

Likes

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

correct answers 2 Correct answers

Adobe Community Professional , Jun 16, 2021 Jun 16, 2021
As 'Mouse UP' event of button field add this: event.target.fillColor = (color.equal(color.yellow, event.target.fillColor)) ? color.red : color.yellow;

Likes

Translate

Translate
Adobe Community Professional , Jun 17, 2021 Jun 17, 2021
Sure, you can use this: if(event.value > 255) event.value = 255; var a = event.value; var b = 255-a; event.target.fillColor = ["RGB",a/255,a/255,a/255]; event.target.textColor = ["RGB",b/255,b/255,b/255];

Likes

Translate

Translate
Adobe Community Professional ,
Jun 16, 2021 Jun 16, 2021

Copy link to clipboard

Copied

As 'Mouse UP' event of button field add this:
event.target.fillColor = (color.equal(color.yellow, event.target.fillColor)) ? color.red : color.yellow;

Likes

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
Explorer ,
Jun 16, 2021 Jun 16, 2021

Copy link to clipboard

Copied

Thanks.

Likes

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
Explorer ,
Jun 17, 2021 Jun 17, 2021

Copy link to clipboard

Copied

Hi, Nesa i need help again.
I have text field which i want to set fill and text colors to be RGB color opposites ( if value is 0 fill is black and text is white)
depending on field value,and if field value is higher then 255 it should be 255.Can you help pls?

Likes

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
Adobe Community Professional ,
Jun 17, 2021 Jun 17, 2021

Copy link to clipboard

Copied

LATEST

Sure, you can use this:
if(event.value > 255)
event.value = 255;
var a = event.value;
var b = 255-a;
event.target.fillColor = ["RGB",a/255,a/255,a/255];
event.target.textColor = ["RGB",b/255,b/255,b/255];

Likes

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