flex-users / flexlib

Open Source Flex components library.
github.com/flex-users/flexlib
MIT License
205 stars 88 forks source link

ScrollableMenu does not honor stage bounds #269

Open nicoulaj opened 13 years ago

nicoulaj commented 13 years ago

Originally filed by m...@typidee.com on 2009-12-22T18:48:43

What steps will reproduce the problem?

  1. Navigate to ScrollableMenu example (http://flexlib.googlecode.com/svn/trunk/examples/ScrollableMenus/ScrollableMenu_Sample.swf)
  2. In Scrollable Menu panel, click Show Menu button.

EXPECTED:

max height of menu should be bounded by the bottom of the stage

ACTUAL:

Menu extends off the bottom of the stage and no scroll bars are displayed

Control Version: current example on this site OS: MacOS 10.6.2 Browser 1: Firefox 3.5.6 Browser 2: Safar 4.04 Flash Player: MAC 10,0,32,18 (DEBUG)

nicoulaj commented 13 years ago

Updated by m...@typidee.com on 2009-12-22T19:09:53

WORKAROUND:

Calculate the available space for the menu and set that value to the maxHeight

var point:Point = new Point();

//translate to global cooridates
point = menuButton.localToGlobal(point);

//calculate maximum possible height, ignoring screen metrics var maxPossibleListHeight:int = dataProvider.length * menu.rowHeight;

//calculate available space between the bottom of the button and the bottom of the stage var stageAvailableHeightBelow:int = this.stage.height - point.y;

//if we don't have enough space below the button to display the desired number of rows //explicitly set the max available height to force the menu to layout (and scroll) in the available space if( stageAvailableHeightBelow < maxPossibleListHeight ) menu.maxHeight = stageAvailableHeightBelow;

menu.show(point.x, point.y);