Copy link to clipboard
Copied
I have a button called Button1 and a checkbox called Checkbox1. Button1 currently has a red thin border. If Checkbox1 is checked, I would like the border to change to green medium. Is this possible?
Copy link to clipboard
Copied
Enter the following Mouse Up action script in the check box:
var oFld=this.getField("Button1");
if(event.target.value=="Off")
{
oFld.borderColor=color.red;
oFld.lineWidth=1;
}
else
{
oFld.borderColor=color.green;
oFld.lineWidth=2;
}
Copy link to clipboard
Copied
Try this:
oFld.fillColor=["RGB", 0.749, 1, 0.749];
or this:
oFld.fillColor=["RGB", 191/255, 255/255, 191/255];
Copy link to clipboard
Copied
Enter the following custom calculation script in the text field:
if(event.value)
{
//Your script if the text field contains a value
}
else
{
//Your script if the text field does not contain a value
}
Copy link to clipboard
Copied
Enter the following Mouse Up action script in the check box:
var oFld=this.getField("Button1");
if(event.target.value=="Off")
{
oFld.borderColor=color.red;
oFld.lineWidth=1;
}
else
{
oFld.borderColor=color.green;
oFld.lineWidth=2;
}
Copy link to clipboard
Copied
That worked. Thank you!
Is there a way to also change the fill color of Button1 when Checkbox1 is checked? From its current shade of light red to a light green? I tried adding this to your script: oFld.fillColor=["RGB", 191 , 255, 191]
but that does not work. I changes the color to white.
;
Copy link to clipboard
Copied
Set the fill color the way you want it then run the following script in the console:
this.getField("Button1").fillColor;
It will return RGB, plus 3 numbers you can use to replace the 3 numbers in the square brackets in your script.
Copy link to clipboard
Copied
Try this:
oFld.fillColor=["RGB", 0.749, 1, 0.749];
or this:
oFld.fillColor=["RGB", 191/255, 255/255, 191/255];
Copy link to clipboard
Copied
Thank you. They both worked.
Copy link to clipboard
Copied
One more thing. Is it possible to change the border color and the fill color if a button if text is entered in a text field. Example, if text is entered in Text Field1, can the border color and the fill color of Button1 be changed from red to green?
Copy link to clipboard
Copied
Enter the following custom calculation script in the text field:
if(event.value)
{
//Your script if the text field contains a value
}
else
{
//Your script if the text field does not contain a value
}
Find more inspiration, events, and resources on the new Adobe Community
Explore Now