In that case, you could listen for the creationComplete event of the child view, then do your setup. creationPolicy="all" is almost cheating.
Tracy ________________________________ From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of arieljake Sent: Wednesday, May 02, 2007 2:06 PM To: [email protected] Subject: [flexcoders] Re: weird accordion consequences Thanks Tracy. I know what you mean about repeated questions. Problem with "pulling" data is that I don't want the Accordion contents to be dependent on where they are getting their data. I would rather the application be responsible for delegating connections between components. Therefore, it will listen to events from child components, and notify others when to respond. I will set it to load children automatically. Thank you. --- In [email protected] <mailto:flexcoders%40yahoogroups.com> , "Tracy Spratt" <[EMAIL PROTECTED]> wrote: > > I really need to have a boilerplate answer for this one! > > The issue you describe is caused by the fact that Accordion and the > other navigator containers by default use a feature called "deferred > instantiation", where a child view is not rendered/instantiated until a > user first navigates to that view. > > Deferred instantiation helps to speed up the initial load of an > application, improving the user's experience. > > The correct way to handle this issue is to use data binding or your own > event system to "pull" data into the view when it is rendered, instead > of trying to access members in the child view from "outside". > > A quick an dirty fix, to determine if this is your p[roblem, is to set > creationPoliccy="all" on the Accordion. But remember, this can hurt the > percieved performance of your app when the child vies become complex. > > Tracy > > -----Original Message----- > From: [email protected] <mailto:flexcoders%40yahoogroups.com> [mailto:[email protected] <mailto:flexcoders%40yahoogroups.com> ] On > Behalf Of Ariel Jakobovits > Sent: Wednesday, May 02, 2007 1:39 PM > To: [email protected] <mailto:flexcoders%40yahoogroups.com> > Subject: [flexcoders] weird accordion consequences > > I am adding an Accordion and am getting an error at runtime saying that > accessing a component located inside the Accordion by its id is null. > FlexBuilder shows no errors. > When I remove the accordion, all is fine. > The code is posted below. Attempting to access > stuffFilter.addEventListener is causing a null error. > > <mx:Panel id="top_canvas" width="100%" height="100%" paddingLeft="5" > paddingRight="5" paddingTop="5" paddingBottom="5"> > > > > <menus:GlobalMenu id="globalMenu" width="100%" /> > > > > <mx:HBox height="100%" width="100%"> > > > <mx:Accordion id="stuffSection"> > > <mx:VBox label="Stuff" width="100%" height="100%"> > > <trees:StuffTree id="stuffTree" width="100%" > height="100%" /> > > </mx:VBox> > > > > <mx:VBox label="Stuff Filter"> > > <form:StuffFilter id="stuffFilter" width="100%" /> > > </mx:VBox> > > </mx:Accordion> > > > <mx:VBox height="100%" width="60%"> > > <mx:Label width="100%" text="Details" /> > > <textarea:StuffDetail id="stuffDetail" width="100%" > height="350" /> > > </mx:VBox> > > </mx:HBox> > > </mx:Panel> > > > > > -- > Flexcoders Mailing List > FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt <http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt> > Search Archives: > http://www.mail-archive.com/flexcoders%40yahoogroups.com <http://www.mail-archive.com/flexcoders%40yahoogroups.com> > Yahoo! Groups Links >

