Thanks Mike

If i want to create a new instance of an mxml component, how can i 
ensure its children get created as well.



--- In flexcoders@yahoogroups.com, "Michael Schmalle" 
<[EMAIL PROTECTED]> wrote:
>
> the flow,
> 
> new VBox()
> 
> "I was wrong about the constructor calling initialize()" :)
> 
> addChild()
>    - addChildAt()
>       - childAdded()
>         - initialize()
>         - createChildren()
> 
> Peace, Mike
> 
> On 4/30/07, Michael Schmalle <[EMAIL PROTECTED]> wrote:
> >
> > Ha it's the morning and just waking up...
> >
> > The real anwer is,
> >
> > addChild() will eventually call createChildren(). Since you have 
not
> > called addChild() on your VBox mxml component, createChildren() 
has not been
> > called.
> >
> > createChildren() does not get called from a constructor call, 
just
> > initialize().
> >
> > Peace, Mike
> >
> > On 4/30/07, Michael Schmalle < [EMAIL PROTECTED]> wrote:
> > >
> > > Hi,
> > >
> > > Don't quote me but,
> > >
> > > I think it has to do that you do not have a parent on your 
main VBox
> > > instance.
> > >
> > > I don't think createComponentsFromDescriptors() is called until
> > > parentChanged() or something is called (IE the parent VBox 
actually has a
> > > parent).
> > >
> > > This shouldn't be a problem, the timing of invalidation gives 
you plenty
> > > of time to initialize your children when they are finally 
added to the
> > > display list of the stage.
> > >
> > > Peace, Mike
> > >
> > > On 4/30/07, bhaq1972 <[EMAIL PROTECTED]> wrote:
> > > >
> > > >   This question is very similar to a question someone else 
is asking
> > > > (may even be the same thing????)
> > > >
> > > > I've got a component called MyPrintView.mxml
> > > >
> > > > <mx:VBox>
> > > > <mx:Label id="contact"/>
> > > > <mx:PrintDataGrid id="printDG"/>
> > > > </mx:VBox>
> > > >
> > > > when i create an instance of MyPrintView, its children are 
not
> > > > created. why is that?
> > > >
> > > > if you addChild() to the Application....they are created. 
why is
> > > > that?
> > > >
> > > > <?xml version="1.0" encoding="utf-8"?>
> > > > <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
> > > > initialize="startUP()">
> > > >
> > > > <mx:Script>
> > > > <![CDATA[
> > > > private function startUP():void
> > > > {
> > > > var printView:MyPrintView = new MyPrintView();
> > > > trace(printView);
> > > > trace(printView.printDG, printView.contact); //both null
> > > > addChild(printView);
> > > > trace(printView.printDG, printView.contact); //both not null
> > > >
> > > > }
> > > > ]]>
> > > > </mx:Script>
> > > > </mx:Application>
> > > >
> > > >  
> > > >
> > >
> > >
> > >
> > > --
> > > Teoti Graphix
> > > http://www.teotigraphix.com
> > >
> > > Blog - Flex2Components
> > > http://www.flex2components.com
> > >
> > > You can find more by solving the problem then by 'asking the 
question'.
> >
> >
> >
> >
> > --
> > Teoti Graphix
> > http://www.teotigraphix.com
> >
> > Blog - Flex2Components
> > http://www.flex2components.com
> >
> > You can find more by solving the problem then by 'asking the 
question'.
> >
> 
> 
> 
> -- 
> Teoti Graphix
> http://www.teotigraphix.com
> 
> Blog - Flex2Components
> http://www.flex2components.com
> 
> You can find more by solving the problem then by 'asking the 
question'.
>


Reply via email to