1 Reply Latest reply on Jun 22, 2011 11:56 AM by paleti.suresh

    how to create a single line text of size close to a given height ?

    Charan Raj Adobe Employee

      hi,

       

      i am given a rectangle of some height and width, i want to fill this rectangle with some dummy single line text. the height and width of text should be close to that of given rectangle. basically, i want the text to full occupy a given rectangular area.

       

      could someone please share some ideas on how to accomplish this ?

       

      thanks,

        • 1. Re: how to create a single line text of size close to a given height ?
          paleti.suresh Level 1

          Try this and let me know if this is what you were looking for.

           

          <?xml version="1.0" encoding="utf-8"?>
          <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                         xmlns:s="library://ns.adobe.com/flex/spark"
                         xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">
              <fx:Declarations>
                  <!-- Place non-visual elements (e.g., services, value objects) here -->
              </fx:Declarations>
              <s:Rect width="100%" height="100" id="myRect">
                  <s:stroke>
                      <s:SolidColorStroke color="#000000" weight="1"/>
                  </s:stroke>
              </s:Rect>
             
              <s:Label text="Single line text in rectangle" fontSize="{myRect.height}"/>
             
          </s:Application>