I replied with the same exact post saying to migrate everything into createChildren();
IMHO, you should never call callLater() on a protected method. There is just something seriously wrong with that path.
I don't know but, I tried it with the create children and set the width (to get it to wrap) and it works fine without the callLater()..
???
> They still end up on top of each other.
You have top post the exact mxml you are using or this is like a dog chasing it's tail. :)
Peace, Mike
It's not actually the events that are giving you a problem, but rather
it's the tricky nature of dealing with auto-sizing text measurement.
Add this statement to your measure function:
trace( "textHeight = " + textField.textHeight );
trace( "height = " + textField.height );
When the components are first added into your VBox, you'll see that
their textHeight is actually 0 and the textField height is 4. Now, when
you roll over the checkboxes and measure is called again, you'll see
those numbers change to be the "actual" values, and that's when they're
drawn correctly.
Here's what I changed your code to to get something that works. It's a
bit of a hack in that it just calls measure again in the constructor
after things have had time to measure, and I cleaned it up a bit to not
rely on those events (you should override createChildren, as I've done
below). Note I've also re-named the class to describe its purpose better:
package
{
import mx.controls.CheckBox;import flash.text.TextFieldAutoSize;
public class MultiLineCheckBox extends CheckBox
{
public function MultiLineCheckBox()
{
super();
callLater( measure );
}
override protected function createChildren():void
{
super.createChildren();textField.wordWrap = true;
textField.autoSize = TextFieldAutoSize.LEFT;textField.border = true;
}
override protected function measure():void
{
super.measure();// Make sure the text field has measured itself
if ( textField.height > 4 )
{
measuredMinHeight = minHeight = textField.height;
}
}
}
}
I hope this helps!
-d
ben.clinkinbeard wrote:
>
> Thanks for the reply Abdul. However, if I remove the
> FlexEvent.CREATION_COMPLETE listener, the checkboxes overlap each
> other. Until I roll over them that is... once I roll over them they
> each pop into the correct, non-overlapping position. I believe the
> problem is that the textbox has not yet resized when INITIALIZE is
> called. The behavior is virtually identical if I remove the INITIALIZE
> listener, leaving only CREATION_COMPLETE; the items overlap until they
> are rolled over. Very strange.
>
> Any ideas?
>
--
What goes up, does come down. __._,_.___
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
![]()
SPONSORED LINKS
Software development tool Software development Software development services Home design software Software development company
YAHOO! GROUPS LINKS
- Visit your group "flexcoders" on the web.
- To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
- Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
__,_._,___
- Re: [flexcoders] Re: What comes after FlexEvent.INITIALIZ... Michael Schmalle
- Re: [flexcoders] Re: What comes after FlexEvent.INIT... Darron J. Schall
- Re: [flexcoders] Re: What comes after FlexEvent.... Michael Schmalle
- Re: [flexcoders] Re: What comes after FlexEv... Michael Schmalle
- [flexcoders] Re: What comes after FlexEvent.INIT... ben.clinkinbeard
- Re: [flexcoders] Re: What comes after FlexEv... Michael Schmalle
- [flexcoders] Re: What comes after FlexEv... ben.clinkinbeard
- Re: [flexcoders] Re: What comes aft... Michael Schmalle
Reply via email to

