Skip to main content
Participant
April 7, 2022
Answered

Change the color of a connected line comment with a checkbox

  • April 7, 2022
  • 1 reply
  • 1321 views

Hello everyone,

 

Im currently discovering adobe acrobate and i encounter some difficulties. I'm working on a railroad map with stations(represented as checkboxes) and segments between the stations. I used the comment option to draw segments of my network on my map, with connected lines. The aim of my work is to show wich segment is in maintenance and wich are still available.I  put checkboxes between each segments. When a checkbox is checked i want the segment before the checked box to be colored as green and if the box is not checked or unchecked the segment color is set to red.i put an example of the map and what i need (i made it manually but i need it to be automatic).

 

The probleme, I dont know how can I change the color of the colored line by checking the box and I don't find so much stuff that suit well my problem.

 

Thank you in advance

Nelson

 

This topic has been closed for replies.
Correct answer Bernd Alheit

In the console window select the whole script and press ctrl + enter.

1 reply

Nesa Nurani
Community Expert
Community Expert
April 7, 2022

At checkbox properties->Action->MouseUp->Run Javascript add this code:
this.getAnnot(0,"Your annot name goes here").strokeColor = event.target.value == "Off" ? color.red : color.green;


To find your annot(drawing) name, select your annot and press CTRL+J
now in console window that pop paste this code:
this.selectedAnnots[0].name;
and press Enter to get name, now copy that name and put it into code where says "Your annot name goes here".

Participant
April 8, 2022

Thanks a lot i think this might work but i encountered a litle problem in the window wich pop when ctrl + j on my annot i can't paste the code or write anything in the javascript section is that normal ?When i put the code on the console window and press enter nothong happens 😕😕

Bernd Alheit
Community Expert
Bernd AlheitCommunity ExpertCorrect answer
Community Expert
April 8, 2022

In the console window select the whole script and press ctrl + enter.