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:[EMAIL PROTECTED] On
Behalf Of Ariel Jakobovits
Sent: Wednesday, May 02, 2007 1:39 PM
To: [email protected]
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
Search Archives:
http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links





Reply via email to