Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Regular Coder
    Join Date
    Feb 2009
    Location
    Worcester
    Posts
    172
    Thanks
    13
    Thanked 6 Times in 6 Posts

    Changing the height of a viewstack dynamically?

    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
    Code:
    <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
    Code:
    <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

    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?

    Just can't figure out what could be causing the crash....

    Hope someone out there can help

  • #2
    Senior Coder nikos101's Avatar
    Join Date
    Dec 2006
    Location
    London
    Posts
    1,007
    Thanks
    59
    Thanked 10 Times in 10 Posts
    You need to give your object in the HTML a height of 100% and the flex application tag a height of 100%.


  • #3
    Banned
    Join Date
    Jul 2009
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thumbs up Decoration service team

    Decoration Engineering Co., Ltd. Hangzhou Meiqi杭州装修公司 provide quality decoration Hangzhou, Hangzhou decoration services, professional provide decoration store in Hangzhou, Hangzhou-store decoration, Hangzhou second-hand housing decoration, office decoration, Hangzhou, Hangzhou office decoration services, we have the professional services of Hangzhou decoration 杭州装饰公司decoration team

  • #4
    Regular Coder
    Join Date
    Feb 2009
    Location
    Worcester
    Posts
    172
    Thanks
    13
    Thanked 6 Times in 6 Posts
    yeah i've tried that but it just doesn't work, any other ideas?


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •