2 Replies Latest reply on Dec 9, 2010 7:07 AM by learner_doug

    How can I make the TextArea border thicker?

    learner_doug Level 1

      I'd like to make the border on some Text Areas thicker/bolder.  Can/how is this done?

      Thanks.

        • 1. Re: How can I make the TextArea border thicker?
          Peter deHaan Level 4

          @learner,

           

          I didn't test this very thoroughly, but it looks like you'll need to create a custom Spark TextArea skin and change the stroke weight:

           

              <s:Rect id="border" left="0" right="0" top="0" bottom="0">

                  <s:stroke>

                      <s:SolidColorStroke id="borderStroke" weight="5"/>           

                  </s:stroke>

              </s:Rect>

           

           

          And then it looks like you need to tweak the updateDisplayList to handle the non-1px width border.

                  override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void

                  {

                      if (getStyle("borderVisible") == true)

                      {

                          border.visible = true;

                          shadow.visible = true;

                          background.left = background.top = background.right = background.bottom = borderStroke.weight;

                          textDisplay.left = textDisplay.top = textDisplay.right = textDisplay.bottom = borderStroke.weight;

                          scroller.left = scroller.right = scroller.top = scroller.bottom = borderStroke.weight;

                          if (promptDisplay) {

                              promptDisplay.setLayoutBoundsSize(unscaledWidth - 5, unscaledHeight - 5);

                              promptDisplay.setLayoutBoundsPosition(5, 5);

                          }

                      }

                      else

                      {

                          border.visible = false;

                          shadow.visible = false;

                          background.left = background.top = background.right = background.bottom = 0;

                          if (promptDisplay)

                          {

                              promptDisplay.setLayoutBoundsSize(unscaledWidth - 1, unscaledHeight - 1);

                              promptDisplay.setLayoutBoundsPosition(1, 1);

                          }

                      }

           

                      borderStroke.color = getStyle("borderColor");

                      borderStroke.alpha = getStyle("borderAlpha");

           

                      super.updateDisplayList(unscaledWidth, unscaledHeight);

                  }

           

           

          Full skin attached (it was a bit too long to paste the whole thing here).

          Probably a better solution out there, but this was the first thing that came to mind.

           

          Peter

          • 2. Re: How can I make the TextArea border thicker?
            learner_doug Level 1

            Thanks Peter, I really appreciate it.

            Doug