Flex Chronicles #7: ViewStack Tip for Flasherz

If your a Flash Developer, when using the ViewStack, ensure it’s creationPolicy is equal to “all”. A ViewStack is a lot like in an Accordion Pane with 1 key difference; by default, the ViewStack does NOT load all of it’s children components. Like a ViewStack, the Accordion does keep all of the other children around, but the ViewStack only instantiates the components the first time they are chosen.

My advice, if your using the ViewStack for what it was made for; delivery of multiple step forms/views (much like a Wizard), make its creationPolicy=”all” so it’ll create all of it’s children as soon as its created, you can register for events for everyone, and treat it like a self-contained component that you’re used too. It’s worth the processor hit. Besides, you can always set it to “auto” or “queued” later if your looking to refactor and optimize your code; by then, you’ll be adding more code to accept the event later vs. adding a lot in the beginning just for the sake of delaying the instantiation of a few components.

2 Replies to “Flex Chronicles #7: ViewStack Tip for Flasherz”

  1. Hi again,

    I changed the line #7 in ‘Batch PNG to SWF.jsf’ for:


    and now it’s working.
    A bit slow, but it is…


  2. OOops. Wrong article….
    Sorry, should have post it to PNG to SWF Batcher article…

Comments are closed.