Hi,
I am subclassing UIComponent to do something very similar to a VBox. The
difference is that when a child is selected, all the children are then moved so
that the selected one is centered vertically on the VBox.
I thought this was easy. But my code never works except for when the
"selectedIndex" is zero (when the top most child is selected). If I try to
change "selectedIndex" after my component is created, the layout never updates.
If I try to set the "selectedIndex" in its MXML tag, it behaves different when
I run it than when I run it in debug mode and step into my layout code...
I look at the mx.containers.VBox and notice it actually uses a utility class
called "BoxLayout" which uses mx_internal namespace.
My code is very simple, in my updateDisplayList, I do:
(pseudo code)
find the selected child,
it's vertical position (compared to the parent) is 0;
do this for each child "above" the selected child
{
its y position is the y position of the child that is right "below" it minus
this child height;
}
do this for each child "below" the selected child
{
its y position is the y position of the child that is right "above" it plus
this child height;
}
I use Container.getExplicitOrMeasuredHeight() to get the actual height.
Right now, I am trying to use the mx_internal BoxLayout and see if it works.
Thanks.