heh,

Ok, now that I have looked at it a second I see what you are saying. Don't have enough time to test this but, I still think using callLater() for anything that deals with the framework is a no-no.

I mean if it gets it to work for you and that is all you need, fine. If you are actually tieing this class into the framework it is definitely not right.

Sorry I don't have enough time to give you my take on it from a framework point of view. :)

Peace, Mike

On 9/6/06, Michael Schmalle < [EMAIL PROTECTED]> wrote:
You know,

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


On 9/6/06, 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?
>




--
What goes up, does come down.



--
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

Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___

Reply via email to