I know better, and I don't do it myself, and I understand why not to do it and
I'm very very
sorry for recommending it : )
--- In [EMAIL PROTECTED]ups.com,
"Gordon Smith" <[EMAIL PROTECTED]> wrote:
>
> <rant>
>
>
>
> Several times a week someone complains that they can't seem to set data
> into controls on the second, third, etc. pane of a ViewStack, Accordion,
> or TabNavigator because these controls don't get created until the user
> navigates to the pane they're on.
>
>
>
> Inevitably there are multiple replies "solving" this problem by
setting
> creationPolicy="all". Inevitably I reply that Adobe doesn't
recommend
> doing this because it defeats the entire purpose of the deferred
> instantiation feature, which is to minimize startup time by not creating
> visual components until they need to be seen.
>
>
>
> A much better technique is to use event handlers to get the appropriate
> data into the controls after they get created. For example, you can use
> the 'initialize' event on each pane, which won't get dispatched until
> after that pane's controls exist.
>
>
>
> <mx:Accordion>
>
> <mx:VBox initialize="textInput1.text='Hello'">
>
> <mx:TextInput id="textInput1"/>
>
> </mx:VBox>
>
> <mx:VBox initialize="textInput2.text='World'">
>
> <mx:TextInput id="textInput2"/>
>
> </mx:VBox>
>
> </mx:Accordion>
>
>
>
> Using databinding is another good technique. The bindings will occur
> after the controls get created.
>
>
>
> I've never seen a case where it is necessary to push data into the
> controls before they exist. If you must put the data somewhere in the
> meantime, store it in data vars, which have none of the startup cost of
> a visual component, and then move it into the controls after they get
> created.
>
>
>
> </rant>
>
>
>
> - Gordon, the Flex framework engineer who designed and implemented the
> deferred instantiation feature, so listen to me on this one!
>