Matt, Thanks for the semi-useful suggestion ;) Tried to set creationPolicy="all" on the view stack and it has the same behavior. For kicks, I also tried moving the call to initLayout to the creationComplete event on the second VBox, this did not help either. Any other ideas?
--- In flexcoders@yahoogroups.com, "Matt Chotin" <[EMAIL PROTECTED]> wrote: > > What happens if you set creationPolicy="all" on the view stack? Maybe > the height it messed up because the VBox was not really ready to accept > children? > > > > ________________________________ > > From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On > Behalf Of pasflex > Sent: Wednesday, November 02, 2005 2:30 PM > To: flexcoders@yahoogroups.com > Subject: [flexcoders] Problem dynamically creating text controls > > > > We have an application where we are dynamically creating various > controls in containers in a viewstack. If a text control is created > in a non-visible layer of the viewstack, the height of the control > is not correct. This only happens for text controls in 1.5. It > does not seem to happen in 2.0. Is this a bug or is there something > we are missing? > > Thanks > > Here is some code that demonstrates the problem: > > <?xml version="1.0" encoding="utf-8"?> > <mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml" > creationComplete="initLayout()"> > <mx:Panel width="250" height="300"> > <mx:ViewStack id="vs" width="100%" height="100%"> > <mx:VBox id="vb1" width="100%" > height="100%"></mx:VBox> > <mx:VBox id="vb2" width="100%" > height="100%"></mx:VBox> > </mx:ViewStack> > </mx:Panel> > <mx:Script> > <![CDATA[ > var textArray = new Array("The quick brown fox > jumped over the lazy dog", > > "The quick brown fox jumped over the lazy dog", > > "The quick brown fox jumped over the lazy dog"); > function initLayout():Void { > for (var i=0; i<textArray.length; i++) { > vb1.createChild > (mx.controls.Text, "", {text:textArray[i], width:"100%"}); > vb2.createChild > (mx.controls.Text, "", {text:textArray[i], width:"100%"}); > } > var vb1Button = vb1.createChild > (mx.controls.Button,"", {label:"vbox 2", id:"button1"}); > vb1Button.addEventListener("click", this); > var vb2Button = vb2.createChild > (mx.controls.Button,"", {label:"vbox 1", id:"button2"}); > vb2Button.addEventListener("click", this); > } > > function handleEvent(event:Object):Void { > if( event.type == "click" ) { > if (event.target.id = "button1") { > vs.selectedIndex = 1; > } > if (event.target.id = "button2") { > vs.selectedIndex = 0; > } > } > } > ]]> > </mx:Script> > </mx:Application> > > > > > > > -- > 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 > > > > * Visit your group "flexcoders > <http://groups.yahoo.com/group/flexcoders> " on the web. > > * To unsubscribe from this group, send an email to: > [EMAIL PROTECTED] > <mailto:[EMAIL PROTECTED] subject=Unsubscribe> > > * Your use of Yahoo! Groups is subject to the Yahoo! Terms of > Service <http://docs.yahoo.com/info/terms/> . > > > > ________________________________ > ------------------------ Yahoo! Groups Sponsor --------------------~--> Get Bzzzy! (real tools to help you find a job). Welcome to the Sweet Life. http://us.click.yahoo.com/A77XvD/vlQLAA/TtwFAA/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/ <*> 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/