Package | flexlib.controls |
Class | public class ScrollableMenu |
Inheritance | ScrollableMenu ![]() |
Subclasses | ScrollableArrowMenu |
Overrides a few methods and properties so we can re-enable scrolling. The
Menu control in the Flex framework intentionally disables vertical scrolling.
This class simply undoes alot of that. We reinstitute normal verticalScrollPolicy
functionality.
See also
Property | Defined by | ||
---|---|---|---|
verticalScrollPolicy : String
Override the verticalScrollPolicy so we can re-instate scrolling functionality.
| ScrollableMenu |
Method | Defined by | ||
---|---|---|---|
Constructor
| ScrollableMenu | ||
createMenu(parent:DisplayObjectContainer, mdp:Object, showRoot:Boolean = true):ScrollableMenu
[static]
We have to override the static function createMenu so that we create a
ScrollableMenu instead of a normal Menu.
| ScrollableMenu | ||
move(x:Number, y:Number):void
| ScrollableMenu | ||
show(xShow:Object = null, yShow:Object = null):void
| ScrollableMenu |
Method | Defined by | ||
---|---|---|---|
configureScrollBars():void
Overridden to reinstate proper scrolling functionality.
| ScrollableMenu | ||
createSubMenu():Menu
| ScrollableMenu | ||
measure():void
We overide the
measure() method because we need to check if the menu is going off
the stage. | ScrollableMenu |
verticalScrollPolicy | property |
verticalScrollPolicy:String
[read-write]Override the verticalScrollPolicy so we can re-instate scrolling functionality.
The mx.controls.Menu class overrides setting and getting the verticalScrollPolicy Basically setting the verticalScrollPolicy did nothing, and getting it always returned ScrollPolicy.OFF. So that's not going to work if we want the menu to scroll. Here we reinstate the verticalScrollPolicy setter, and keep a local copy of the value in a private variable _verticalScrollPolicy.
Implementation public function get verticalScrollPolicy():String
public function set verticalScrollPolicy(value:String):void
ScrollableMenu | () | constructor |
public function ScrollableMenu()
Constructor
configureScrollBars | () | method |
protected override function configureScrollBars():void
Overridden to reinstate proper scrolling functionality.
The Menu class overrode configureScrollBars() and made the function do nothing. That means the scrollbars don't know how to draw themselves, so here we reinstate configureScrollBars. This is basically a copy of the same method from the mx.controls.List class. It would have been nice if we could have called this method from down in a subclass of Menu, but AS doesn't let us do something like super.super, so instead we have to recreate the class here.
createMenu | () | method |
public static function createMenu(parent:DisplayObjectContainer, mdp:Object, showRoot:Boolean = true):ScrollableMenu
We have to override the static function createMenu so that we create a ScrollableMenu instead of a normal Menu.
Parametersparent:DisplayObjectContainer |
|
mdp:Object |
|
showRoot:Boolean (default = true )
|
ScrollableMenu |
createSubMenu | () | method |
protected function createSubMenu():Menu
Returns
Menu |
measure | () | method |
protected override function measure():void
We overide the measure()
method because we need to check if the menu is going off
the stage. If it's going to be too high, then we make it smaller to keep it from
going off. I also stuck in a buffer of 10 pixels from the bottom of the stage.
We also check if we're showing the vertical scrollbar, and if so we adjust the
width to account for that.
move | () | method |
public override function move(x:Number, y:Number):void
Parameters
x:Number |
|
y:Number |
show | () | method |
public override function show(xShow:Object = null, yShow:Object = null):void
Parameters
xShow:Object (default = null )
|
|
yShow:Object (default = null )
|