I have next hierarchy:
<s:TabBar dataProvider="{stack}" />
<mx:ViewStack id="stack" width="100%">
<s:NavigatorContent width="100%" label="123" backgroundColor="#c02c31" >
<s:BorderContainer minHeight="200">
<s:List id="testList" width="100%" contentBackgroundColor="#f00fff" contentBackgroundAlpha="0"/>
</s:BorderContainer>
</s:NavigatorContent>
</mx:ViewStack>
And I want achieve next: when testList.dataProvider
have changed, List changes its size, and NavigatorContent also changes its size. But now NavigatorContent doesn't change it size depends on its children. What I am doing wrong?
I wrote code to test it:
private var _testDP1:Array = ["aaa", "bbb", "ccc", "ddd", "eee", "fff", "ggg", "aaa", "bbb", "ccc", "ddd", "eee", "fff", "ggg"];
private var _testDP2:Array = ["aaa", "bbb", "ccc", "ddd", "eee", "fff", "ggg"];
private var _someFlag:Boolean = false;
private function onClick(event:MouseEvent):void
{
if (!_someFlag)
{
testList.dataProvider = new ArrayList(_testDP1);
_someFlag = true;
} else
{
testList.dataProvider = new ArrayList(_testDP2);
_someFlag = false;
}
}
And how it looks now. At start: http://gyazo.com/65755dbd66346a49455344a767098b27
With _testDP1: http://gyazo.com/007a76d03cc8c9c88c75439446e01102
With _testDP2: http://gyazo.com/7dfccf00b7c39f6eb1cdac96298893d1
UPD:
I check with another parent (but with same skin): SkinnableContainer
. And it works properly. So something wrong with NavigatorContent or ViewStack.
I found solution myself. There is a magic property resizeToContent
that solve my problem!