I don't know if this achieves what you want or not. var myV:Panel = new MyView(); *myV.initialize();* trace (myV.getChildren().length); iterateOverChildren(myV);
On Mon, Aug 24, 2009 at 5:59 PM, alexeoscar <alexeos...@yahoo.com> wrote: > When I read this > > http://livedocs.adobe.com/flex/3/html/help.html?content=layoutperformance_06.html > > I thought the "childDescriptors" method is independent from the life cycle, > it would let me introspect the component without adding to display. What did > I miss ? How do I introspect a component before displayed. > > --- In flexcoders@yahoogroups.com, Wesley Acheson <wesley.ache...@...> > wrote: > > > > It may be because of deferred instantiation the component doesn't > actually > > have children yet. > > > > On Fri, Aug 21, 2009 at 10:29 PM, alexeoscar <alexeos...@...> wrote: > > > > > Suppose you have a MyView.mxml file, which is basically a Panel with > > > several children (Form, FormItems, Buttons...). > > > > > > Is it possible to iterate over the MyView and get all the information > about > > > its children (types, id ...) before it is displayed. > > > > > > In my Main.mxml if I have this function > > > > > > public function iterateOverChildren(comp:Container):void { > > > // Get the number of descriptors. > > > trace("Running iterateOverChildren for " + comp.id); > > > if (comp != null) > > > { > > > var n:int = comp.childDescriptors.length; > > > for (var i:int = 0; i < n; i++) { > > > var c:ComponentDescriptor = comp.childDescriptors[i]; > > > var d:Object = c.properties; > > > > > > // Log ids and types of objects in the Array. > > > trace(c.id + " is of type " + c.type); > > > > > > // Log the properties added in the MXML tag of the > object. > > > for (var p:String in d) { > > > trace("Property: " + p + " : " + d[p]); > > > } > > > } > > > } > > > } > > > > > > > > > Why does this call not work ? > > > > > > var myV = MyView(); > > > iterateOverChildren(myV); > > > > > > It only works if I add a statement like > > > addChild(myV); > > > before the iterateOverChildren call. (But that's not what I want, I > want to > > > iterate the descriptions without adding it to display). > > > > > > -alex > > > > > > > > > > > > > > > > > > > > > > > > ------------------------------------ > > > > > > -- > > > Flexcoders Mailing List > > > FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt > > > Alternative FAQ location: > > > > https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-1e62079f6847 > > > Search Archives: > > > http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups > > > Links > > > > > > > > > > > > > > > > > > > ------------------------------------ > > -- > Flexcoders Mailing List > FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt > Alternative FAQ location: > https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-1e62079f6847 > Search Archives: > http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups > Links > > > >