5 Replies Latest reply: Apr 17, 2012 2:54 PM by CarlosCanto RSS

    Applying multiple strokes with JS

    LemonJoe Community Member

      Does anybody have any idea, how to apply multiple strokes to a path with JavaScript? Assigning strokes width, caps, position in stack (my particular concern)? All i can do at the moment is to apply a single stroke. Thanks in advance!

        • 1. Re: Applying multiple strokes with JS
          CarlosCanto CommunityMVP

          you can't apply multliple strokes, the one thing you can do is, create a graphic style (by hand) with all your attributes (stroke width, caps, multiple strokes, etc) then apply that graphic style via JS.

           

          caps, stroke width, position

          yourpath.strokeCap = StrokeCap.ROUNDENDCAP;
          yourpath.strokeWidth = 5;
          yourpath.zOrder (ZOrderMethod.SENDTOBACK);
          
          • 2. Re: Applying multiple strokes with JS
            LemonJoe Community Member

            I'm writing a script that would generate random stroke appearences on the fly, so using premade graphic styles does not work for me. Your samples work for a single stroke and so far i can't figure out how to apply several of them to the same path. Every next setting overwrites the previos. Can't get, say, two storkes of different width and color applied to the same path.

            yourpath.zOrder (ZOrderMethod.SENDTOBACK); works in the layers stack for moving layers up and down, and i would like to move strokes in appearance tab the same way. Can't figure out how to make it either. Thank you anyway, Carlos!

            • 3. Re: Applying multiple strokes with JS
              Muppet Mark Community Member

              As far as I know you can't… In my ( fluffy ) mind appearnce is kind of a secret group provided by plug-in ( like the masons funny handshakes ) In script you would have to stack the objects and group ( if needed )

              • 4. Re: Applying multiple strokes with JS
                LemonJoe Community Member

                Stacking several paths with different strokes might be a solution, but i was hoping for more elegant one :). Ok, if even Muppet Mark doesn't know then nothing left but to go with this one. Thanks!

                • 5. Re: Applying multiple strokes with JS
                  CarlosCanto CommunityMVP

                  yeah, unfortunately, half the features are not accessible to scripting.