Couldn't agree more Gordon. Thanks for the rant and for posting this!


| Aaron West
| aaron AT trajiklyhip DOT com
| http://www.trajiklyhip.com/blog/
| Certified Advanced Adobe ColdFusion MX 7 Developer
| Certified Macromedia FlashMX Developer
| Adobe Community Expert


On Oct 30, 2006, at 3:47 PM, Gordon Smith wrote:

<x-tad-bigger><rant></x-tad-bigger>
<x-tad-bigger> </x-tad-bigger>
<x-tad-bigger>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.</x-tad-bigger>
<x-tad-bigger> </x-tad-bigger>
<x-tad-bigger>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.</x-tad-bigger>
<x-tad-bigger> </x-tad-bigger>
<x-tad-bigger>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.</x-tad-bigger>
<x-tad-bigger> </x-tad-bigger>
<x-tad-bigger>            <mx:Accordion></x-tad-bigger>
<x-tad-bigger>                        <mx:VBox initialize="textInput1.text='Hello'"></x-tad-bigger>
<x-tad-bigger>                                    <mx:TextInput id="textInput1"/></x-tad-bigger>
<x-tad-bigger>                        </mx:VBox></x-tad-bigger>
<x-tad-bigger>                        <mx:VBox initialize="textInput2.text='World'"></x-tad-bigger>
<x-tad-bigger>                                    <mx:TextInput id="textInput2"/></x-tad-bigger>
<x-tad-bigger>                        </mx:VBox></x-tad-bigger>
<x-tad-bigger>            </mx:Accordion></x-tad-bigger>
<x-tad-bigger> </x-tad-bigger>
<x-tad-bigger>Using databinding is another good technique. The bindings will occur after the controls get created.</x-tad-bigger>
<x-tad-bigger> </x-tad-bigger>
<x-tad-bigger>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.</x-tad-bigger>
<x-tad-bigger> </x-tad-bigger>
<x-tad-bigger></rant></x-tad-bigger>
<x-tad-bigger> </x-tad-bigger>
<x-tad-bigger>- Gordon, the Flex framework engineer who designed and implemented the deferred instantiation feature, so listen to me on this one!</x-tad-bigger>
<x-tad-bigger> </x-tad-bigger>
__._,_.___

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com

<image.tiff>


SPONSORED LINKS
Software development tool
Software development
Software development services
Home design software
Software development company

<x-tad-smaller> Your email settings: Individual Email|Traditional</x-tad-smaller>
<x-tad-smaller>Change settings via the Web</x-tad-smaller><x-tad-smaller> (Yahoo! ID required) </x-tad-smaller>
<x-tad-smaller> Change settings via email: </x-tad-smaller><x-tad-smaller>Switch delivery to Daily Digest</x-tad-smaller><x-tad-smaller> | </x-tad-smaller><x-tad-smaller>Switch to Fully Featured</x-tad-smaller><x-tad-smaller> </x-tad-smaller>
<x-tad-smaller> Visit Your Group </x-tad-smaller><x-tad-smaller> </x-tad-smaller><x-tad-smaller>| </x-tad-smaller><x-tad-smaller>Yahoo! Groups Terms of Use </x-tad-smaller><x-tad-smaller> </x-tad-smaller><x-tad-smaller>| </x-tad-smaller><x-tad-smaller>Unsubscribe </x-tad-smaller>
__,_._,___

Reply via email to