Package | Top Level |
Class | public class OptionPanel |
optionPanel
object.
See also
Method | Defined by | ||
---|---|---|---|
addButton(button:OptionButton):void
Adds the given button to the panel.
| OptionPanel | ||
buttonCount():Number
Returns the number of buttons on the option panel.
| OptionPanel | ||
close():void
Closes the option panel.
| OptionPanel | ||
getButtonAt(index:Number):void
Gets the button at the specified index.
| OptionPanel | ||
isOpen():Boolean
Returns
true if the panel is open. | OptionPanel | ||
open():void
Opens the option panel.
| OptionPanel | ||
removeButton(button:OptionButton):void
Removes the specified button.
| OptionPanel |
addButton | () | method |
public function addButton(button:OptionButton):void
Adds the given button to the panel.
Parametersbutton:OptionButton — The button to add to the panel.
|
-- Create the button button = OptionButton:new() button:setName("my button") -- Register an event listener button:addEventListener("click", "button_click") -- Add it to the option panel optionPanel:addButton(button) function button_click(event) dialogs:showMessage("'"..event.sender:getName().."' has been clicked!") end
buttonCount | () | method |
public function buttonCount():Number
Returns the number of buttons on the option panel.
ReturnsNumber — Number of buttons.
|
function getButtonByName(buttonName) buttonCount = optionPanel:buttonCount() for i = 0, (buttonCount - 1) do button = optionPanel:getButtonAt(i) if buttonName == button:getName() return button end end end helpButton = getButtonByName("Help")
close | () | method |
public function close():void
Closes the option panel.
getButtonAt | () | method |
public function getButtonAt(index:Number):void
Gets the button at the specified index.
Parametersindex:Number — Button index.
|
See also
isOpen | () | method |
public function isOpen():Boolean
Returns true
if the panel is open.
Boolean — true if the panel is open.
|
function toggleOptionPanel() if optionPanel:isOpen() then optionPanel:close() else optionPanel:open() end end toggleOptionPanel()
open | () | method |
public function open():void
Opens the option panel.
removeButton | () | method |
public function removeButton(button:OptionButton):void
Removes the specified button.
Parametersbutton:OptionButton — The button to remove from the panel.
|
lastButton = optionPanel:getButtonAt(optionPanel:buttonCount() - 1) optionPanel:removeButton(lastButton)