0 Replies Latest reply on Nov 10, 2011 7:06 AM by ealysse1

    New to Flex - Issue with swatches & fillColor

    ealysse1

      Hi Everyone,

      I'm new to scripting in Adobe, though I have experience with Java.  Quick background - I'm running trial versions of both Flash Builder and Creative Suite Extension Builder to test them out prior to purchase.  My problem is with using swatches and fillColor.  From what I've found, it seems like these should not have any problem since I am importing com.adobe.illustrator.*, but my scripts throw errors.  I have two examples of code below and both seem to have the same issue whether I'm trying to access defaultFillColor or fillColor- Attempted access of inaccessible method through a reference with static type com.adobe.illustrator...  The first script I haven't gotten to work yet.  The second script works, but doesn't fill the triangle.  Any insight would be greatly appreciated.  Thanks in advance!

       

      Script 1:

      {

          import com.adobe.csawlib.illustrator.Illustrator;

          import com.adobe.csxs.core.csxs_internal;

          import com.adobe.illustrator.*;

         

          public class testOne

          {

              private static var app:Application = Illustrator.app;

              public function functionTestOne()

              {

                  // add a layer

                  app.activeDocument.layers.add();

                  var InfoLayer = Illustrator.app.activeDocument.activeLayer.name("Info Layer");

                 

                  // create a rectangle using swatch to fill

                  Illustrator.app.activeDocument.defaultFillColor("Fusion");

                  var rectOne = colorInfoLayer.pathItems.rectangle( 72, 72, 72, 72 );

                }

           }

      }

       

      Script 2:

      {

          import com.adobe.csawlib.illustrator.Illustrator;

          import com.adobe.illustrator.*;

       

          public class testTwo

          {

             

              public function createDocument():void

              {

                  var application:Application = Illustrator.app;

                  var document:Document = application.documents.add();

                  var trianglePath:PathItem = document.pathItems.add();

                  trianglePath.setEntirePath(new Array(new Array(100, 100), new Array(300, 100), new Array(200, Math.tan(1.0471975) * 100 + 100) ) );

                  trianglePath.closed = true;

                  trianglePath.stroked = true;

                  trianglePath.filled = true;

                  trianglePath.strokeWidth = 3;

                  document.pathItems[0].fillColor = document.swatches.getByName("White").color;

                  var model:AppModel = AppModel.getInstance();

              }

          }