Hey,

I will look at this and come up with an answer. :)

I just guessed. ;-)

Peace, Mike

On 9/6/06, ben.clinkinbeard < [EMAIL PROTECTED]> wrote:

Hi Michael,

Unfortunately, that code didn't help :( They still end up on top of
each other.

I am dispatching the newChildAdded event in the method that sets the
textField to autoSize and wordWrap to true so that I can call
invalidateDisplayList() in the parent VBox. Without that call the VBox
seems to stack them just like they're single line CheckBoxes.

Thanks,
Ben

--- In [email protected], "Michael Schmalle"


<[EMAIL PROTECTED]> wrote:
>
> Hi Ben,
>
> Why don't you do this?
>
>
> // **** SuperCheckBox.as ***
> package
> {
> import mx.controls.CheckBox;
> import mx.events.FlexEvent;
> import flash.text.TextFieldAutoSize;
> import flash.events.Event;
>
> public class SuperCheckBox extends CheckBox
> {
> public function SuperCheckBox()
> {
> super();
> }
>
> override protected function createChildren():void
> {
> super.createChildren();
> if(textField)
> {
> textField.wordWrap = true;
> textField.autoSize = TextFieldAutoSize.LEFT;
> textField.border = true;
> }
> //dispatchEvent(new Event("newChildAdded", true)); // Why do you
do this?
> }
>
> override protected function measure():void
> {
> super.measure();
> measuredMinHeight = measuredHeight = textField.height;
> }
> }
> }
>
> Peace, Mike
>
> PS is ther need to call that newChildAdded event?
>
> On 9/6/06, Abdul Qabiz <[EMAIL PROTECTED]> wrote:
> >
> > I believe, you should use INITIALIZE in your case. I see, you are
> > setting measuredMinHeight in doStuff (..) method..
> >
> > Initialize would dispatached before any layouting or measuring
happens (or
> > before updateDisplayList (..) is invoked?)..
> >
> > However, please check out..
> >
> > -abdul
> >
> >
> > On 9/6/06, ben.clinkinbeard <[EMAIL PROTECTED] > wrote:
> > >
> > > Hello, I have created a CheckBox whose label can accomodate
multiline
> > > text by constructing a CheckBox subclass (mockingly) named
> > > SuperCheckBox. I am adding a set of them to a VBox inside a
loop, but
> > > in order to get them properly spaced (not overlapping), I am
having to
> > > call both FlexEvent.INITIALIZE and FlexEvent.CREATION_COMPLETE.
I know
> > > I am doing something wrong and shouldn't have to call both, but
can't
> > > figure out which event is fired once the whole SuperCheckbox
component
> > > is done resizing its text box. Any help is appreciated; my code is
> > > below.
> > >
> > > // in my Canvas
> > > vb = VBox(addChild(new VBox()));
> > > vb.setStyle("verticalGap", 20);
> > > vb.addEventListener("newChildAdded", updateVBox);
> > >
> > > for(var i:int = 0; i < labelsArray.length; i++)
> > > {
> > > var cb:SuperCheckBox = new SuperCheckBox();
> > > cb.label = labelsArray[i];
> > > cb.width = 400;
> > > vb.addChild(cb);
> > > }
> > >
> > > private function updateVBox(event:Event):void
> > > {
> > > vb.invalidateDisplayList();
> > > }
> > >
> > > // **** SuperCheckBox.as ***
> > > package
> > > {
> > > import mx.controls.CheckBox;
> > > import mx.events.FlexEvent;
> > > import flash.text.TextFieldAutoSize;
> > > import flash.events.Event;
> > >
> > > public class SuperCheckBox extends CheckBox
> > > {
> > > public function SuperCheckBox()
> > > {
> > > super();
> > > addEventListener(FlexEvent.INITIALIZE, doStuff);
> > > addEventListener(FlexEvent.CREATION_COMPLETE, doStuff);
> > > }
> > >
> > > private function doStuff(event:Object):void
> > > {
> > > this.textField.wordWrap = true;
> > > this.textField.autoSize = TextFieldAutoSize.LEFT;
> > > this.textField.border = true;
> > > measuredMinHeight = measuredHeight = this.textField.height;
> > > dispatchEvent(new Event("newChildAdded", true));
> > > }
> > >
> > > override protected function measure():void
> > > {
> > > super.measure();
> > > measuredMinHeight = measuredHeight = this.textField.height;
> > > }
> > > }
> > > }
> > >
> > > Thanks,
> > > Ben
> > >
> > >
> >
> >
>
>
>
> --
> 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