0 Replies Latest reply on Aug 9, 2010 11:58 AM by jinx1981

    How to draw variable width borders around a rounded rectangle

    jinx1981

      Hi,

       

      I am pretty new to flex and would like to know if we can draw variable width borders around a rounded rectangle. For eg, in HTMl we would set inline styles such as border-left: 3px;border-right: 5px; border-top: 3px;border-bottom: 7px;

       

      I currently have this method which uses linestyle method to draw borders around the rounded rectangle but the line style method takes only one integer and applies to all the four corners, if i were to apply different border thickness her how would i achive it ?

       

      Following is the snippet of code drawing borders along with rounded corners on a rectangle

       

         graphics.clear();

            if (backgroundColor && backgroundColor.length) {

       

              var mGradientOrientation:Number=0;

       

              var gColors:Array=[];

       

              var gAlphas:Array=[colorAlpha, colorAlpha];

       

              var gRatio:Array=[0, 255];

       

              backgroundColor=backgroundColor.split(' ').join(''); //trim     

       

              var matrix:Matrix=new Matrix();

       

              matrix.createGradientBox(stage.stageWidth - borderThickness, stage.stageHeight - borderThickness, mGradientOrientation);

       

              graphics.beginGradientFill(GradientType.LINEAR, gColors, gAlphas, gRatio, matrix);

       

            }

       

           graphics.lineStyle(borderThickness, borderColor, borderAlpha);

       

            graphics.drawRoundRectComplex(borderThickness / 2, borderThickness / 2, stage.stageWidth - borderThickness, stage.stageHeight - borderThickness, cornerRadius[0], cornerRadius[1], cornerRadius[2], cornerRadius[3]);

       

            graphics.endFill();

       

       

      Any help  here is appreciated!!!!!