I think I understand your point, but those events are also called "at random" by rolling over elements and such, aren't they? I guess the way I see it is that we are just faking a rollOver :)
Ben --- In flexcoders@yahoogroups.com, "Michael Schmalle" <[EMAIL PROTECTED]> wrote: > > Hi Ben, > > Well you know what, people have called me extreme, can you believe that?! > ;-) > > Anyway, I am totally an advocate of callLater(), just not using callLater() > with the framework template methods. > > IE > > - commitProperties() > - measure() > - updateDisplayList() > > Think about it this way, the LayoutManager that is the scheduler for the > whole framework uses callLater(), but it schedules all calls to the above > methods in a very methodical, sequential order. > > Order, the is what is beautiful about the template method pattern, you can > always count on the order of things happening. > > When you add a call like callLater(measure) that messes things up. > > Example, you always run the chance of calling measure() in a component and > it could call another invalidation method. > > Essentially calling callLater(measure) is the equivalent of the framework > calling invalidateSize(). > > The difference is the invalidateSize() schedules the measure() call based on > nets level and other invalidation factors. > > The last statement is my rationale for not doing it. :) > > Peace, Mike > > On 9/7/06, ben.clinkinbeard <[EMAIL PROTECTED]> wrote: > > > > 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 flexcoders@yahoogroups.com <flexcoders%40yahoogroups.com>, "Darron > > J. Schall" <darron@> 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? > > > > > > > > > > > > > > > > > -- > 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 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/