Skip navigation
ic3man7019
Currently Being Moderated

How might you draw a border around a rectangle in Flex?

Jun 12, 2013 12:34 PM

Tags: #flex-4.6 #flex_mobile

I need to know how to draw a gray border around a rectangle using MXML, without filling the rectangle with any color. I also need to know how to design the screen so that the components (in this case I have a couple text input fields, a button, and a checkbox) appear within the rectangle. The rectangle should not take up the entire width or height of the screen.

 
Replies
  • Currently Being Moderated
    Jun 12, 2013 1:04 PM   in reply to ic3man7019
     
    |
    Mark as:
  • Currently Being Moderated
    Jun 13, 2013 8:45 AM   in reply to ic3man7019

    Use a Group. Set its width and heigth to whatever size. Inside the group use a Rect with width and height of 100%. Give it a stroke.

     

    Example:

     

    <s:Group width="100" height="100">

    <s:Rect width="100%" height="100%">

         <s:bottomLeftRadiusX>2</s:bottomLeftRadiusX>

         <s:bottomLeftRadiusY>2</s:bottomLeftRadiusY>

         <s:bottomRightRadiusX>2</s:bottomRightRadiusX>

         <s:bottomRightRadiusY>2</s:bottomRightRadiusY>

         <s:topLeftRadiusX>2</s:topLeftRadiusX>

         <s:topLeftRadiusY>2</s:topLeftRadiusY>

         <s:topRightRadiusX>2</s:topRightRadiusX>

         <s:topRightRadiusY>2</s:topRightRadiusY>

         <s:fill>

              <s:SolidColor color="#ffffff" />//if this color value doesn't work then use 0xffffff

         </s:fill>

         <s:stroke>

              <s:SolidColorStroke weight="1" color="#000000"  />//if this color value doesn't work then use 0x000000

         </s:stroke>

    </s:Rect>

    </s:Group>

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points