| Package | flexlib.controls |
| Class | public class ScrollableMenu |
| Inheritance | ScrollableMenu mx.controls.Menu |
| Subclasses | ScrollableArrowMenu |
Default MXML PropertydataProvider
See also
| Property | Defined By | ||
|---|---|---|---|
| dataProvider : Object [override] [write-only] | ScrollableMenu | ||
| hideOnActivity : Boolean = true | ScrollableMenu | ||
| rowCount : int [override] [write-only]
| ScrollableMenu | ||
| verticalScrollPolicy : String [override]
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 | ||
hide():void [override]
| ScrollableMenu | ||
move(x:Number, y:Number):void [override]
| ScrollableMenu | ||
show(xShow:Object = null, yShow:Object = null):void [override] | ScrollableMenu | ||
| Method | Defined By | ||
|---|---|---|---|
clearMenu(row:IMenuItemRenderer):void
Clear the menu reference from the menu item renderer
| ScrollableMenu | ||
configureScrollBars():void [override]
Overridden to reinstate proper scrolling functionality. | ScrollableMenu | ||
createSubMenu():Menu | ScrollableMenu | ||
measure():void [override]
We overide the measure() method because we need to check if the menu is going off
the stage. | ScrollableMenu | ||
mouseUpHandler(event:MouseEvent):void [override] | ScrollableMenu | ||
onScroll(event:ScrollEvent):void
Callback function called when the menu scroll bar is scrolled
| ScrollableMenu | ||
updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void [override]
| ScrollableMenu | ||
| dataProvider | property |
dataProvider:Object [write-only] [override] public function set dataProvider(value:Object):void| hideOnActivity | property |
public var hideOnActivity:Boolean = true| rowCount | property |
rowCount:int [write-only] [override]
public function set rowCount(value:int):void| verticalScrollPolicy | property |
verticalScrollPolicy:String[override] Override the verticalScrollPolicy so we can re-instate scrolling functionality. <p>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.</p>
public function get verticalScrollPolicy():String public function set verticalScrollPolicy(value:String):void| ScrollableMenu | () | Constructor |
public function ScrollableMenu()Constructor
| clearMenu | () | method |
protected function clearMenu(row:IMenuItemRenderer):voidClear the menu reference from the menu item renderer
Parameters
row:IMenuItemRenderer — The menu item renderer
|
| configureScrollBars | () | method |
override protected function configureScrollBars():voidOverridden to reinstate proper scrolling functionality. <p>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.</p>
| createMenu | () | method |
public static function createMenu(parent:DisplayObjectContainer, mdp:Object, showRoot:Boolean = true):ScrollableMenuWe have to override the static function createMenu so that we create a ScrollableMenu instead of a normal Menu.
Parameters
parent:DisplayObjectContainer | |
mdp:Object | |
showRoot:Boolean (default = true) |
ScrollableMenu |
| createSubMenu | () | method |
protected function createSubMenu():MenuReturnsMenu |
| hide | () | method |
override public function hide():void
| measure | () | method |
override protected function measure():voidWe overide the <codeph>measure()</codeph> 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.
| mouseUpHandler | () | method |
override protected function mouseUpHandler(event:MouseEvent):voidParameters
event:MouseEvent |
| move | () | method |
override public function move(x:Number, y:Number):void
Parameters
x:Number | |
y:Number |
| onScroll | () | method |
protected function onScroll(event:ScrollEvent):voidCallback function called when the menu scroll bar is scrolled
Parameters
event:ScrollEvent — The scroll event
|
| show | () | method |
override public function show(xShow:Object = null, yShow:Object = null):voidParameters
xShow:Object (default = null) | |
yShow:Object (default = null) |
| updateDisplayList | () | method |
override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
Parameters
unscaledWidth:Number | |
unscaledHeight:Number |