Copy link to clipboard
Copied
Hi, I need help making my button field alternate between yellow and red when it's clicked. TIA
As 'Mouse UP' event of button field add this:
event.target.fillColor = (color.equal(color.yellow, event.target.fillColor)) ? color.red : color.yellow;
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];
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;
Copy link to clipboard
Copied
Thanks.
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?
Copy link to clipboard
Copied
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];