AccordionMenu

Kind of class: public class
Package:
Inherits from:
Version: 16 Jun 2010 Faster panel animations
11 Jun 2010
Author: John Polacek, john@johnpolacek.com
Classpath: com.johnpolacek.ui.AccordionMenu
File last modified: Tuesday, 24 Augustus 2010, 17:26:45
The AccordionMenu class extends the BasicButtonMenu class to support the addition of expandable panels to the buttons
Example

  • var accordion:AccordionMenu = new AccordionMenu(); Add expandable panel 'panelExample' to the top button accordion.addPanel(panelExample, 0); Add expandable BasicButtonMenu panel to the 2nd button accordion.addPanelMenu(buttonMenu, 1); Add event listener to detect when a main accordion button is clicked accordion.addEventListener(UIEvent.BUTTON_SELECT, onNavButtonSelect); Add event listener to detect when expandable panel button is clicked accordion.addEventListener(UIEvent.DROPDOWN_SELECT, onSubNavButtonSelect);

Summary

Constructor
Instance methods
  • selectButton (buttonIndex:int) : void
    • Selects the active button for the menu
  • addPanel (panel:Sprite, buttonIndex:int) : void
    • Adds an expandable panel to the targeted button
  • addPanelMenu (menu:BasicButtonMenu, buttonIndex:int) : void
    • Adds an expandable panel menu to the targeted button
  • expandPanel () : void
    • Expands the panel of the currently selected button (only 1 panel is expanded at a time)
  • collapse () : void
    • Collapses the open panel
  • onCollapseComplete () : void
    • Actions taken after the panel is collapsed
  • animateExpand () : void
    • Panel expanding animation
  • onExpandComplete () : void
    • Actions taken after the panel is expanded
  • onPanelMenuSelect (event:UIEvent) : void
    • Panel menu button select handler
  • updateMasks () : void
    • Updates sizes of masks for dynamic panel sizes

Constructor

AccordionMenu

function AccordionMenu(ba:Number = .9)
Parameters
ba:Alpha of button when not selected. Default .9

Instance properties

currPanel

currPanel:int = -1(read,write)

isExpanded

isExpanded:Boolean = false(read,write)

isTweening

isTweening:Boolean = false(read,write)

masks

masks = [](read,write)

panels

panels = [](read,write)

Instance methods

addPanel

function addPanel(panel:Sprite, buttonIndex:int) : void

Adds an expandable panel to the targeted button

addPanelMenu

function addPanelMenu(menu:BasicButtonMenu, buttonIndex:int) : void

Adds an expandable panel menu to the targeted button

animateExpand

function animateExpand() : void

Panel expanding animation

collapse

function collapse() : void

Collapses the open panel

expandPanel

function expandPanel() : void

Expands the panel of the currently selected button (only 1 panel is expanded at a time)

onCollapseComplete

function onCollapseComplete() : void

Actions taken after the panel is collapsed

onExpandComplete

function onExpandComplete() : void

Actions taken after the panel is expanded

onPanelMenuSelect

function onPanelMenuSelect(event:UIEvent) : void

Panel menu button select handler

selectButton

override function selectButton(buttonIndex:int) : void

Selects the active button for the menu

updateMasks

function updateMasks() : void

Updates sizes of masks for dynamic panel sizes