For performance reasons, renderers get validated once and not checked
again, so you can't just figure out the size later.
 
An example is in ListItemRenderer.  Its internal textfield handles
wordwrap correctly.  The OP could just use it, but it doesn't handle
html.  I'd just copy the source and wire the listData.label to the
htmlText.

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Josh McDonald
Sent: Wednesday, August 06, 2008 9:13 PM
To: [email protected]
Subject: Re: [flexcoders] Re: Advise - List



You mean this is causing measure() to report the wrong height for the
renderer itself? Wouldn't measure get called again once the text
component has layed out and worked out its height in a frame or 3?
What's the answer? Set text.width, call validateNow() before you use
text.height in renderer.measure()?

Intriguing :)

-Josh


On Thu, Aug 7, 2008 at 1:48 PM, Alex Harui <[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]> > wrote:


        I think the OP really wants it to be in a renderer, which has
slightly different rules
         
        A renderer is given explicitWidth before it is measured, and for
text flow components, it should set the with of that component then take
its measurements.

________________________________

        From: [email protected]
<mailto:[email protected]>  [mailto:[email protected]
<mailto:[email protected]> ] On Behalf Of Josh McDonald
        Sent: Wednesday, August 06, 2008 8:45 PM
        To: [email protected]
<mailto:[email protected]> 
        Subject: Re: [flexcoders] Re: Advise - List
        
        

        

        You can set it to 100%, or to a binding like:
        
        <vbox id="bar">
          <text id="txt" width="{vbox.width}"/>
        </vbox>
        
        Either will work just make sure that you set it :)
        
        If you're doing that and it's not wrapping, you may need
collapseWhite="true" (or something named like that) on your mx:Text,
depending on how you've set up your html!
        
        -Josh
        
        
        On Thu, Aug 7, 2008 at 1:38 PM, Rafael Faria
<[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> >
wrote:
        

                I need it to be 100%... its on a component that goes in
different
                places on my application. I can't set it =/
                
                Any other idea?
                
                I'm trying to set the textarea's height when i load it
but it doesnt
                seem to be getting the right height.
                
                I tested a simple example like the following one and if
you run it you
                will see that when you open its bigger than the text but
when you
                start typing it gets back to the right size.
                
                <?xml version="1.0"?>
                <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml
<http://www.adobe.com/2006/mxml> "
                creationComplete="update();">
                <mx:Script>
                      <![CDATA[
                          import mx.events.FlexEvent;
                
                          public function update():void
                          {
                             src.explicitHeight = src.textHeight + 10;
                             src.dispatchEvent(new
KeyboardEvent("KEY_DOWN"));
                          }
                
                      ]]>
                  </mx:Script>
                   <mx:Panel title="TextArea Control Example"
height="75%"
                width="75%"  paddingTop="10" paddingLeft="10">
                
                       <mx:TextArea id="src" change="update()">
                       <mx:htmlText>
                               <![CDATA[
                                       Lorem Ipsum is simply dummy text
of the printing and
                typesetting industry. Lorem Ipsum has been the
industry's standard
                dummy text ever since the 1500s, when an unknown printer
took a galley
                of type and scrambled it to make a type specimen book.
It has survived
                not only five centuries, but also the leap into
electronic
                typesetting, remaining essentially unchanged. It was
popularised in
                the 1960s with the release of Letraset sheets containing
Lorem Ipsum
                passages, and more recently with desktop publishing
software like
                Aldus PageMaker including versions of Lorem Ipsum.
                               ]]>
                       </mx:htmlText>
                       </mx:TextArea>
                
                   </mx:Panel>
                </mx:Application>
                



                --- In [email protected]
<mailto:[email protected]> , "Josh McDonald" <[EMAIL PROTECTED]>
wrote:
                >
                > Text will wrap, but only if you tell it how wide it
should be.
                >
                > -Josh
                >
                > On Thu, Aug 7, 2008 at 12:59 PM, Rafael Faria
                
                > <[EMAIL PROTECTED]>wrote:
                
                >
                > > Hey guys,
                > >
                > > I need some advise.
                > >
                > > I'm creating a list and i need to insert some HTML
text (i need to use
                > > bold) and it needs to wordwrap it.
                > >
                > > I tried Text but it doesnt seem to have wordwrap
capability. The only
                > > reason i found so far is use a Textarea and take off
the borders and
                > > background and not let it be editable. It works how
i want but with a
                > > little problem, the variable row doesnt seem to be
working. My guess
                > > would be that my textarea is not increasing
according the size of the
                > > text in the textarea.
                > >
                > > Is there anyway to set the textarea height according
to the content it
                > > has or anyother suggestion to make this html
wordwrap itemrenderer
                > > inside the list work?1
                > >
                > > Please, enlight me. :p
                > >
                > > raf
                > >
                > >
                > >
                > > ------------------------------------
                > >
                > > --
                > > Flexcoders Mailing List
                > > FAQ:
http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
<http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt> 
                > > Search Archives:
                > >
http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo
<http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo> ! Groups
                > > Links
                > >
                > >
                > >
                > >
                >
                >
                
                > --
                > "Therefore, send not to know For whom the bell tolls.
It tolls for
                thee."
                >
                > :: Josh 'G-Funk' McDonald
                
                > :: 0437 221 380 :: [EMAIL PROTECTED]
                
                >
                
                
                
                ------------------------------------
                
                --
                Flexcoders Mailing List
                FAQ:
http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
<http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt> 
                Search Archives:
http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo
<http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo> ! Groups
Links
                
                
                   (Yahoo! ID required)
                
                   mailto:[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]> 
                
                
                
                




        -- 
        "Therefore, send not to know For whom the bell tolls. It tolls
for thee."
        
        :: Josh 'G-Funk' McDonald
        :: 0437 221 380 :: [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> 
        

        

        




-- 
"Therefore, send not to know For whom the bell tolls. It tolls for
thee."

:: Josh 'G-Funk' McDonald
:: 0437 221 380 :: [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> 


 

Reply via email to