Highlighted

JavaScripting linear fill

Avatar

Avatar

mistersing

Avatar

mistersing

mistersing

16-10-2008

Trying to get a linear fill, top to bottom, in a button or field using JavaScripting so I can change the colors when needed. Adobe documentation says it can be done, but is not clear as to how to get the desired result. Any ideas?

Thank you.

Replies

Avatar

Avatar

pguerett

Total Posts

7.7K

Likes

611

Correct Answer

692

Avatar

pguerett

Total Posts

7.7K

Likes

611

Correct Answer

692
pguerett

16-10-2008

Not sure what you mean can you elaborate?
Highlighted

Avatar

Avatar

mistersing

Avatar

mistersing

mistersing

16-10-2008

In a button or field you can use the following code to add a fill or background color:



fieldname.border.fill.color.value = "255,0,0";



I would like to be able to do the same thing with a top to bottom linear (gradient) background 2-color fill.
Highlighted

Avatar

Avatar

pguerett

Total Posts

7.7K

Likes

611

Correct Answer

692

Avatar

pguerett

Total Posts

7.7K

Likes

611

Correct Answer

692
pguerett

16-10-2008

OK now I understand. You will have to setup your field with the appearance the way you want (i.e. Linear toBottom) with white to white before you run your script. This will give the same appearance as a normal field but it will put the neccessary nodes in the XDP to allow you to manipulate them. Once you do this you will need three commands to complete your change.



1. To set the style of the appearance:

TextField1.ui.textEdit.border.fill.linear.type = "to Bottom";



2. Set the color that you are fading to:

TextField1.ui.textEdit.border.fill.linear.color.value = "0,0,255";



3. Set the colro of the field that you are starting from:

TextField1.ui.textEdit.border.fill.color.value = "255,0,0";



Lastly you will need to put fous on the field to have your changes applied:

xfa.host.setFocus("TextField1");