On Wed, Jun 3, 2009 at 11:46 PM, Amy <[email protected]> wrote: > --- In [email protected], Manish Jethani <manish.jeth...@...> wrote: >> >> On Wed, Jun 3, 2009 at 10:26 PM, Manish Jethani >> <manish.jeth...@...> wrote: >> > 2009/6/3 j2me_soul <j2me_s...@...>: >> >> >> override protected function measure():void{ >> >> this.explicitMinWidth = this.explicitMinHeight = 50; >> >> } >> >> } >> > >> > Here you should set the meauredWidth, measuredHeight, and optionally >> > measuredMinWidth and measuredMinHeight (they can be set to the same as >> > measuredWidth and measuredHeight respectively). >> >> I forgot to say how to do the measurement. Here's how I'd do it: >> >> function measure():void >> { >> measuredWidth = lal.getExplicitOrMeasuredWidth(); >> measuredHeight = lal.getExplicitOrMeasuredHeight(); >> } > > Do you need to use setActualSize on the label before you measure it?
No. setActualSize() should be called in updateDisplayList(). That is called after the measurement phase. The Label object will measure itself based on the text assigned to it, so it doesn't care what size you have set on it (for the purpose of measurement). The Label object's getExplicitOrMeasuredWidth() and getExplicitOrMeasuredHeight() methods will return the values computed in its measure() implementation. Manish

