3 Replies Latest reply on Aug 10, 2010 3:16 PM by mike_morales

    Word wrap with Flex 4

    fresher4flex

      Hi, Can someone help me in getting a wordwrap in Spark. Below is my code. Any help regarding this is highly Appreciated

      I  am trying to get wordwrap within a spark component, but I couldn't. Can someone fix this. Usoing Label or richtext or any control but not textinput or richeditabletext.

      I am also trying to copy paste the text. But I could not do that. How to do that?

       

       

       

       

      <?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" xmlns:com="com.*" xmlns:local="*">

       

       

      <fx:Declarations>

       

       

      <!-- Place non-visual elements (e.g., services, value objects) here -->

       

       

      </fx:Declarations>

       

       

       

       

      <s:Panel x="229" y="158" width="250" height="200" >

       

       

      <s:VGroup id="vGroup1" top="5" bottom="5" left="5" right="5" gap="-2" variableRowHeight="true" width="240" height="190">

       

       

      <s:HGroup width="100%" gap="0" id="hGroup1" left="5" height="100%">

       

       

      <s:VGroup width="100%" id="vGroup2" gap="-2" right="35" height="100%">

       

      <mx:Text id="t" fontWeight="bold" htmlText="You can format the text in a Text control using HTML tags,

      which are applied after the control's CSS

       

      "

       

      />

       

      <mx:Text id="DIS_Subject" width="100%" htmlText="The Text hhhhhhhhh control displays multiline"/>

       

       

      </s:VGroup>

       

       

      <mx:Image id="iconComplete" width="16"/>

       

       

       

      </s:HGroup>

       

      <mx:Text textIndent="20" text="using HTML tags, which are hhhhhhhhh 888899999999 end " id="DIS_Author" width="100%" height="100%"/>

       

       

      <mx:Text text="ext control displays m mmmmmmmmmmmmm 5555555555end" id="lastReply" width="90%" height="100%"/>

       

      </s:VGroup>

       

       

       

      </s:Panel>

      </s:Application>

        • 1. Re: Word wrap with Flex 4
          mike_morales Level 2

          Looks like you just missed setting a width on your <mx:Text> component. Once you explictly set a width, it should wrap.  (the text component you have named/ID'd as "t" in your code does not have a width set.

          • 2. Re: Word wrap with Flex 4
            fresher4flex Level 1

            Thank you for the reply, but when I am looking for wordwrap i couldnot find that property inside the text tag. If you got can yousend me the fixed code.

            • 3. Re: Word wrap with Flex 4
              mike_morales Level 2

              well, it's more of a behavior, for lack of a better word, of  the component's width (rather than a documented property) You won't find it in the class definition. So, you just need to set the width.  In your code, you originally had;

               

              <mx:Text id="t" fontWeight="bold" htmlText="You can format the text in a Text control using HTML tags,which are applied after the control's CSS"/>

               

              you just need to set the width for that component, something like  <mx:Text id="t" width="100%" . . . />  just as you did with the others.  As soon as I set a width on it, it wrapped.


              * note, after setting the width, be sure to 'refresh' your design view to update your changes.