Home Tutorials Forums Articles Blogs Movies Library Employment Press

Go Back   ActionScript.org Forums > Flex > Flex 2, 3 & 4

Reply
 
Thread Tools Rate Thread Display Modes
Old 12-06-2008, 04:00 PM   #1
pulse00
Senior Member
 
Join Date: May 2008
Posts: 112
Default Nested VBox not showing vertical scrollbar

hi,

i need to scroll content inside a nested vbox, but for some reason
the scrollbars won't appear.

Code:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" creationComplete="initApp()" verticalGap="0"> 
  
  <mx:Button toggle="true" click="on_click(event)" id="toggle" label="toggle outer scrollpolicy"/>
  <mx:VBox id="outerBox" width="100%" height="400" verticalScrollPolicy="off" horizontalScrollPolicy="off" backgroundColor="0xff0000">
    <mx:HBox width="100%" height="100%">
      <mx:Label text="Foo" width="100%"/>
    </mx:HBox>
    <mx:VBox width="100%" height="100%" id="innerBox" backgroundColor="0x00ff00" verticalScrollPolicy="on"/>
  </mx:VBox>
    
  <mx:Script>
    <![CDATA[
      import mx.controls.Button;
      
      private function initApp():void {
        
        for (var i:uint=0; i < 20; i++)
          innerBox.addChild(new Button());
        
      }
      
      private function on_click(e:Event):void {
        
        if (toggle.selected)
          outerBox.verticalScrollPolicy = "on";
        
        else outerBox.verticalScrollPolicy = "off";
        
      }
    ]]>
  </mx:Script> 
</mx:Application>
Shouldn't the "innerBox" display a scrollbar when it's content is larger than it's size ?

When enabling the verticalSCrollPolicy on the outerBox, the scrolling works, but it also scrolls the first inner HBox, which should stay where it is.

Only the second inner Box should be scrollable, don't know why it doesn't work though.

Anyone ?
pulse00 is offline   Reply With Quote
Old 12-06-2008, 04:30 PM   #2
pulse00
Senior Member
 
Join Date: May 2008
Posts: 112
Default

solved:

the VBoxes scrollbar policy seems to only kick in when defining a fixed height,
so changing the above code to this works:

Code:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" creationComplete="initApp()" verticalGap="0"> 
  

  <mx:Canvas id="outerBox" width="100%" height="400" verticalScrollPolicy="off" horizontalScrollPolicy="off" backgroundColor="0xff0000">
    <mx:HBox width="100%" id="firstInnerBox" top="0">
      <mx:Label text="Foo" width="100%"/>
    </mx:HBox>
    <mx:VBox width="100%" top="{firstInnerBox.height}" height="{outerBox.height-firstInnerBox.height}" id="innerBox" backgroundColor="0x00ff00" verticalScrollPolicy="on"/>
  </mx:Canvas>
    
  <mx:Script>
    <![CDATA[
      import mx.controls.Button;
      
      private function initApp():void {
        
        for (var i:uint=0; i < 20; i++)
          innerBox.addChild(new Button());
        
      }
      
    ]]>
  </mx:Script> 
</mx:Application>
pulse00 is offline   Reply With Quote
Old 05-14-2012, 05:11 PM   #3
the_new_mr
Registered User
 
Join Date: May 2012
Posts: 1
Default

I registered here just to say thanks!

Thanks for taking the time to answer yourself. You saved me a LOT of time!
the_new_mr is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Scrollbar not at the top of a VBox when loading new content tata668 Flex 2, 3 & 4 2 08-16-2007 11:41 PM
Scrollbar for browser window not showing up! Dahrken ActionScript 2.0 4 04-07-2007 05:51 PM
Dynamic text field not showing in nested MC... BraveStarr ActionScript 2.0 1 07-12-2006 08:24 AM
need help controlling vertical position of scrollbar martincrumlish ActionScript 2.0 7 07-10-2004 10:36 AM
Dynamic menu inside scrollPane but missing vertical scrollbar ? rgny ActionScript 1.0 (and below) 2 03-19-2003 07:37 AM


All times are GMT. The time now is 12:55 AM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.