In the previous post I gave an example of our DataNavigators in action as you would expect them to be used, with a dataProvider and ItemRenderer but you may well be asking…
I want navigators where all the elements can be different, not driven by data all using the same ItemRenderer.
This is the obvious usage of navigators as we know them (ViewStack, TabNavigator).
Well DataGroup has a sneaky little secret. It isn’t just capable or reusing ItemRenderers, its also capable of achieving deferred instantiation on elements defined inside it (thanks to Ryan Frishberg for this info).
To do this you set the itemRenderer property to null, the add your elements inside an ArrayList. Using this method its only when the element is required to be displayed that it is created.
Unfortunately this isn’t a complete solution as it isn’t capable of handling FXG as an element, it has to be wrapped inside another container.
I developed a DeferredGroup class to get over this limitation, but its success is dependent on changes to the SDK. I have 2 items in the Flex Bugbase referring to this, so if you would like to DeferredGroup (a Group that supports deferred instantiation and FXG), please go and vote on them…
The components used in the following example are the same as the example in the previous post, but instead of using an ItemRenderer and setting a dataProvider the elements that need to be displayed are specified (check the numElements count, compared to the previous examples numRenderers count):
The source for the code can be downloaded from our Google Code repository

Very nice discovery. I voted for both. Unfortunately I think the SDK is locked for the 4.0 release. We’ll probably have to wait for the first update to the SDK to get your suggestions in.
Great post Tink! That’s a sweet little discovery.
…wow, too bad the second of those two bugs got deferred. I agree with you completely on that. Nonetheless, I voted for both to be fixed (even the second is technically marked “closed”, which is sucky). I really like what you’re doing here… there is a lot that can be learned from this post!
Hey Tink
I was trying to use this example using the library from google code, but deffered instantiation is not enabled. Everything is created immediately.
DataNavigator was populated with two groups and both were created at the very beginning.
Can you share the classes which were used in this sample ?
Hi mico
Can you show me an example of what you are doing and enable view source.
http://192.168.0.1/tmp/tink_dn_sample.html
sorry, it is http://195.182.130.50/tmp/tink_dn_sample.html
This is because the default value for the property
useVirtualLayoutonws.tink.spark.layouts.StackLayoutis nowfalse.As mentioned previously in a reply, if your adding elements instead of using an
ItemRendereranddataProviderI’d recommend looking wasNavigatorandNavigatorGroup.Great, that worked! Also, I build that using NavigatorGroup as you recommended. Got some errors related to skins first when Navigator was used .
Thanks a lot!