cheerq / flexlib

Automatically exported from code.google.com/p/flexlib
0 stars 0 forks source link

ScrollableMenu does not honor stage bounds #269

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
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)

Original issue reported on code.google.com by Typi...@gmail.com on 22 Dec 2009 at 6:48

Attachments:

GoogleCodeExporter commented 8 years ago
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);

Original comment by Typi...@gmail.com on 22 Dec 2009 at 7:09