views:

1209

answers:

4

I have an HBox in my flex application. The problem is, when there are too many things inside the HBox a scroll bar appears at the bottom of the app. How can I make it appear in the HBox, so the scrollbar only scrolls thestuff inside the HBox and not the entire app?

A: 
<Application 
xmlns="http://www.adobe.com/2006/mxml" 
horizontalScrollPolicy="off">
    <HBox width="100%">
    ...

I believe that should work.

toby
A: 

Right. But this prevents any scrolling. I just want the scroll bar to appear under the hbox. And while I'm at it, how do I set the horizontalAlign property in a script? It isn't showing up...

Aethex
+2  A: 

Try creating a Canvas around the HBox. If you declare the width of the Canvas to 100%, it should be the width of the stage, and when the HBox inside gets wider, a scrollbar should appear.

Niko Nyman
A: 

Niko, That works! BTW I needed the horizontalAlign in case there aren't enough items to fully populate the entire width of the HBox. The way you change it is myHBox.setStyle ("horizontalAlign", "center");

Aethex