SuperViewStack

by Ruben

For a Flex project I'm working on I decided I would need a ViewStack that also showed the children underneath the selectedChild. As some might know, the ViewStack class displays its children by setting the visibility of one to true, and that of the others to false.
This got me expecting that bringing my concept of an extended ViewStack would be a piece of cake, some piece that was.. Eventually I ended up extending the Canvas class, rather than ViewStack, because the latter seemed to have some creationPolicy issues and doesn't like instanciating children that are not its selectedChild.

SuperViewStack by default displays all of its children that are underneath its selectedChild.
You can easily adjust the factor with which underlying children fade, and with what tint. It is also possible to switch back to normal ViewStack mode.
SuperViewStack has almost all of the functionality that ViewStack has, and all the child-methods (for example addChild()) are still functional.

So go check out the demo, if you're interested you can also check out the source and documentation.

One 'feature' that might seem a little odd to some is that it uses reversed z-indexing, which means that the first added child is on top, and the last on the bottom of the stack. However, you won't notice much of this since all of it is worked out underwater and the first added child still has 0 (zero) as its index, and the fifth will still have 4 as its index..