Can't write to The applyStroke attribute

Find out why the . goes before the /

Moderator: Paul Tuersley

Post Reply
Aaron_Ecthelion
Posts: 1
Joined: December 30th, 2016, 7:00 am

December 30th, 2016, 7:04 am

I have several lines of simple code like this:
     var myComp = app.project.activeItem;
     var myLayer = myComp.layer(1);
     myLayer.sourceText.value.applyStroke = true;
     alert(myLayer.sourceText.value.applyStroke);
 
 
However, the applyStroke doesn't work properly, I can read its value, but can't write it. According to the official scripting guide, it's read/write.
         
[img=620x187]https://forums.adobe.com/servlet/JiveSe ... 3526/1.png[/img]
But the 3rd line just doesn't work! I wonder why! Is this a bug? !
Hope I've made myself clear.
jordanwade33
Posts: 14
Joined: December 8th, 2014, 11:11 pm

January 4th, 2017, 4:52 pm

I'm not sure if you've already solved this, but I ran into something similar with Markers, so I thought I would share my experience. 

It is read/write, but you need to set the value again after changing it, it doesn't update automatically. If you want to change other attributes (font size, colors, etc.), just change those before the setValue. The code below seems to work, hopefully it makes sense.

Code: Select all

var myComp = app.project.activeItem;
var myTextProp = myComp.layer(1).sourceText;
var myText = myTextProp.value;
myText.applyStroke = true;
myTextProp.setValue(myText);
Post Reply