Thanks Darron! That works beautifully. Although I can't believe you don't think SuperCheckBox is an accurate name :)
Michael, I would be interested in hearing your rationale, because so far it seems like a perfectly valid way of dealing with the underlying processes of Flash/Flex. Thanks all, Ben --- In [email protected], "Darron J. Schall" <[EMAIL PROTECTED]> wrote: > > 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? > > > ------------------------ Yahoo! Groups Sponsor --------------------~--> Yahoo! Groups gets a make over. See the new email design. http://us.click.yahoo.com/WktRrD/lOaOAA/yQLSAA/nhFolB/TM --------------------------------------------------------------------~-> -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ <*> Your email settings: Individual Email | Traditional <*> To change settings online go to: http://groups.yahoo.com/group/flexcoders/join (Yahoo! ID required) <*> To change settings via email: mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/

