1 Reply Latest reply on Jun 16, 2011 4:11 AM by david_a_clark

    Is it possible to convert a cmyk color to an rgbcolor with the illustrator api?

    JamieOoms

      I have the following code and i would like to know the rgb values of the cmyk color:

      Is this possible with the extension builder?

       

       

       

      public function DocumentGenerator(aiDocument:Document)

      {

      _aiDocument = aiDocument;

       

       

      for(var i:int=0; i < _aiDocument.swatches.length; i++)

      {

       

      var swatch:Swatch = _aiDocument.swatches.index(i);

       

       

       

      if(swatch.name != "[None]")

      {

       

      if(swatch.color is SpotColor)

      {

       

      var spotColor:SpotColor = SpotColor(swatch.color);

       

      if(spotColor.spot.color is CMYKColor)

      {

       

      var cmykColor:CMYKColor = CMYKColor(spotColor.spot.color);

       

      // This line throws an invalid cast error

      var rgbColor:RGBColor = RGBColor(swatch.color);

       

       

      var colorname:String = swatch.name;

      }

       

      }

      }

      }

      }