2 Replies Latest reply on Oct 4, 2010 1:42 PM by eastportme

    SkinnableContainer kills linebreaking?


      I've only been using Flex/Flashbuilder for about two weeks, so apologies if this is just newbie confusion...


      After struggling to set backgrounds in HGroups and VGroups I finally learned about skinning. I converted one of my other containers to a SkinnableContainer, created the simplest possible (I think) Skin, and now my RichText component no longer linebreaks! This is despite setting the lineBreak attribute to "toFit" in every conceivable place.


      The layout I'm working with is fairly complex, but I've reduce the problem to the code below. You'll see the SkinnableContainer -- there is also a commented out Group tag near it. If I remove the SkinnableContainer and replace it with a simple Group, line breaking occurs as I expect. Below this code is the Skin I am using. Any guidance would be most welcome; I had been planning to use a large set of SkinnableContainter components containing blocks of text for my app, but if linebreaking won't work, I've got a problem. Below the code I include images of the screen, once with the SkinnableContainer, and once with the plain Group.



      <?xml version="1.0" encoding="utf-8"?>
      <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
                        minWidth="955" minHeight="600" xmlns:components="components.*">
           <fx:Style source="assets/ad.css"/>
           <s:Group width="100%" height="100%">
                <s:SkinnableContainer xmlns:fx="http://ns.adobe.com/mxml/2009" 
                                           xmlns:mx="library://ns.adobe.com/flex/mx"  skinClass="advanced_directive_skins.WhiteSkin"  
                                           width="100%" >
                     <!--<s:Group width="100%">-->
                               import ad_skins.WhiteSkin;
                     <s:Group width="100%" height="100%" x="0" y="0">
                          <s:RichText paddingTop="15" paddingLeft="15" paddingRight="30" lineBreak="toFit" width="100%">                                                                                                              
                                    <s:TextFlow lineBreak="toFit">                                        
                                         <s:div fontSize="22" fontWeight="bold" color="#715304">Gettysburg Address
                                         <s:div fontSize="14">
                                              <s:p paragraphSpaceBefore="10" paragraphStartIndent="0" lineBreak="toFit">Four score and seven years ago our 
                                                   fathers brought forth on this continent, a new nation, conceived in Liberty, 
                                                   and dedicated to the proposition that all men are created equal.                                                   
                                                   Now we are engaged in a great civil war, testing whether that nation, 
                                                   or any nation so conceived and so dedicated, can long endure. We are met 
                                                   on a great battle-field of that war. We have come to dedicate a portion of that field, 
                                                   as a final resting place for those who here gave their lives that that nation might 
                                                   live. It is altogether fitting and proper that we should do this.                                                  
                                                   But, in a larger sense, we can not dedicate - we can not consecrate 
                                                   - we can not hallow - this ground. The brave men, living and dead, 
                                                   who struggled here, have consecrated it, far above our poor power to add or detract. 
                                                   The world will little note, nor long remember what we say here, but it can never 
                                                   forget what they did here. It is for us the living, rather, to be dedicated here 
                                                   to the unfinished work which they who fought here have thus far so nobly advanced. 
                                                   It is rather for us to be here dedicated to the great task remaining before us - 
                                                   that from these honored dead we take increased devotion to that cause for which they 
                                                   gave the last full measure of devotion - that we here highly resolve that these dead 
                                                   shall not have died in vain - that this nation, under God, shall have a new birth of 
                                                   freedom - and that government of the people, by the people, for the people, shall not 
                                                   perish from the earth.



      And the skin:



      <?xml version="1.0" encoding="utf-8"?>
      <s:Skin xmlns:fx="http://ns.adobe.com/mxml/2009" 
                <!-- Place non-visual elements (e.g., services, value objects) here -->
                <s:State name="normal"/>
                <s:State name="disabled"/>
           <s:Rect x="0" y="0" height="100%" width="100%">
                     <s:SolidColor color="#FFFFFF"/>               
           <s:Group id="contentGroup">
      The appearance with SkinnableContainer:

      ...and the appearance with Group:



      Thanks for any help!