loki421
07-10-2009, 08:56 PM
Hi all,
I have a viewstack that holds multiple components, most of which have list controls at different heights. I want to be able to resize the height of the viewstack based on the height of the contained list controls so that the lists themselves don't scroll, kinda like an HTML page would if you where looping over a database, the page would resize accordingly.
Anyway, here's what i've got
<mx:ViewStack id="viewstack1" width="100%" >
<views.component1 width="100%" />
<views.component2 width="100%" />
<views.component3 width="100%" />
</mx:ViewStack>
Example of function in component
<mx:Script>
<![CDATA[
private function getHeight(event:Event):void{
var height:Number = new Number;
height = (listTesting.height + 300);
Application.application.viewstack1.height = height;
}
]]>
</mx:Script>
<mx:List dataProvider="{myData}"
id="listTesting"
itemRenderer="views.listTestingView"
themeColor="#FFFFFF"
borderStyle="none"
paddingRight="10"
columnWidth="590" top="30"
variableRowHeight="true"
rowCount="{listTesting.dataProvider.length}"
editable="true" width="590" x="0"
creationComplete="getHeight(event)"/>
Now that works fine, until i try to navigate to another 'page' or index, then the whole app crashes :confused:
It's like it works fine for the first time it's fired, but once you navigate to the next component (where a simular function is fired on CreationComplete of that list), it just falls over, nothing responds.
Any ideas what's going wrong here? Is my AS3 a little wrong? :p
Just can't figure out what could be causing the crash....
Hope someone out there can help :D
I have a viewstack that holds multiple components, most of which have list controls at different heights. I want to be able to resize the height of the viewstack based on the height of the contained list controls so that the lists themselves don't scroll, kinda like an HTML page would if you where looping over a database, the page would resize accordingly.
Anyway, here's what i've got
<mx:ViewStack id="viewstack1" width="100%" >
<views.component1 width="100%" />
<views.component2 width="100%" />
<views.component3 width="100%" />
</mx:ViewStack>
Example of function in component
<mx:Script>
<![CDATA[
private function getHeight(event:Event):void{
var height:Number = new Number;
height = (listTesting.height + 300);
Application.application.viewstack1.height = height;
}
]]>
</mx:Script>
<mx:List dataProvider="{myData}"
id="listTesting"
itemRenderer="views.listTestingView"
themeColor="#FFFFFF"
borderStyle="none"
paddingRight="10"
columnWidth="590" top="30"
variableRowHeight="true"
rowCount="{listTesting.dataProvider.length}"
editable="true" width="590" x="0"
creationComplete="getHeight(event)"/>
Now that works fine, until i try to navigate to another 'page' or index, then the whole app crashes :confused:
It's like it works fine for the first time it's fired, but once you navigate to the next component (where a simular function is fired on CreationComplete of that list), it just falls over, nothing responds.
Any ideas what's going wrong here? Is my AS3 a little wrong? :p
Just can't figure out what could be causing the crash....
Hope someone out there can help :D