Package | com.eqsim.components |
Class | public class ButtonMomentary |
Inheritance | ButtonMomentary ![]() |
This class implements a momentary push button with an optional repeater. Developers can configure
how much time to wait until repeating starts, and the frequency for the repeat onPress
event generated. Developers can change the
appearance by changing the defaultButtonUpClassName
and defaultButtonDownClassName
properties to Sprite/MovieClip classes
in the Library.
The class has six events, by default called:
onPress
- Generated when button first pressed, and repeated at specified frequencyonRelease
- Generated when button releasedonReleaseOutside
- Generated when button released outside confines of the hit areaonRollOver
- Generated when cursor rolls over button hit areaonRollOut
- Generated when cursor rolls out of button hit areaonDisabled
- Generated if the user does any operation above (except ReleaseOutside) when the button is disabled (i.e., enabled == false)The events have no data associated with them, except in the case of the onDisabled event: its data is a String indicating the type is the event that would have been invoked, i.e., onPress, onRelease, etc. If one registers for onDisabled, the caller will receive notices for all the events, since the user is subscribing to the onDisabled event.
Property | Defined By | ||
---|---|---|---|
defaultButtonDownClassName : String
Property for changing the graphics (skin) of the button's down (pressed) state. | ButtonMomentary | ||
defaultButtonUpClassName : String
Property for changing the graphics (skin) of the button's up (unpressed) state. | ButtonMomentary | ||
evtDisabled : String = onDisabled
Event name of disabled event (when button clicked but button has enabled == false). | ButtonMomentary | ||
evtPress : String = onPress
Event name of onPress event. | ButtonMomentary | ||
evtRelease : String = onRelease
Event name of onRelease event. | ButtonMomentary | ||
evtReleaseOutside : String = onReleaseOutside
Event name of onReleaseOutside event. | ButtonMomentary | ||
evtRollOut : String = onRollOut
Event name of onRollOut event. | ButtonMomentary | ||
evtRollOver : String = onRollOver
Event name of onRollOver event. | ButtonMomentary | ||
pulseFreq : int = 100
Sets the interval (in milliseconds) between repeated onPress when the button is pressed. | ButtonMomentary | ||
showHand : Boolean
Boolean property indicating whether or not to display the hand cursor when the cursor is over this component. | ButtonMomentary | ||
wait4Start : int = 250
Sets the duration (in milliseconds) to wait after the user has pressed the left mouse button
and before the button begins to repeat the onPress event. | ButtonMomentary |
Property | Defined By | ||
---|---|---|---|
butDownSkin : Sprite
Sprite containing the button down skin. | ButtonMomentary | ||
buttonContainer : Sprite
Sprite container used for scaling button easily. | ButtonMomentary | ||
butUpSkin : Sprite
Sprite containing the button up skin. | ButtonMomentary | ||
_defaultButtonDownClassName : String = ButtonMomentaryDefaultDown | ButtonMomentary | ||
_defaultButtonUpClassName : String = ButtonMomentaryDefaultUp | ButtonMomentary | ||
repeaterInstance : Timer
Timer used internally to implement repeater behavior. | ButtonMomentary | ||
repeatPressQuiet : Boolean
If true, repeated presses are quiet (no evtPress generate), false is regular (evtPress generated)
| ButtonMomentary | ||
_showHand : Boolean = true | ButtonMomentary | ||
timeUntilRepeat : Timer
Timer instance for waiting while mouse is down until we start repeating. | ButtonMomentary |
Method | Defined By | ||
---|---|---|---|
ButtonMomentary | |||
destroy():void
Releases the listeners and any memory associated with the component. | ButtonMomentary | ||
execEvent(evtName:String, evtVal:* = null, q:Boolean = false):void
This method is used to programmatically invoke an action of the component based on
the event passed in. | ButtonMomentary |
Method | Defined By | ||
---|---|---|---|
changeDownSkin():void | ButtonMomentary | ||
changeUpSkin():void | ButtonMomentary | ||
configUI():void [override]
configUI
Get the display objects created in preparation of launch. | ButtonMomentary | ||
disabled(val:String, q:Boolean = false):void
Generates onDisabled event. | ButtonMomentary | ||
draw():void [override]
| ButtonMomentary | ||
generateEvent(type:String, q:Boolean):void
Generates the given event type passed in. | ButtonMomentary | ||
mouseDown(me:MouseEvent):void
When mouse clicked, do the button press action. | ButtonMomentary | ||
mouseRollOut(me:MouseEvent):void
Mouse leaves button hit area. | ButtonMomentary | ||
mouseRollOver(me:MouseEvent):void
Mouse rolls over button hit area. | ButtonMomentary | ||
mouseUp(me:MouseEvent):void
Mouse is released; release the button and stop the repeater or any stage we're at, as well. | ButtonMomentary | ||
mouseUpHandlerForReleaseOutside(me:MouseEvent):void
Catches 'mouse up' when the mouse is released (inside the button or outside). | ButtonMomentary | ||
press(q:Boolean = false):void
Called when button pressed, we generate the onPress event and setup mechanism to see if we should repeat. | ButtonMomentary | ||
release(q:Boolean = false):void
Button is released, stop anything dependent on that and generate the onRelease event. | ButtonMomentary | ||
releaseOutside(q:Boolean = false):void
Button released with mouse outside the hit area of the button. | ButtonMomentary | ||
repeatPressHandler(te:TimerEvent):void
Called on each repetition while repeater is active. | ButtonMomentary | ||
rollout(q:Boolean = false):void
Generates onRollOut event. | ButtonMomentary | ||
rollover(q:Boolean = false):void
Generates onRollOver event. | ButtonMomentary | ||
setDown(buttonState:Boolean):void
Sets the graphics to the appropriate visual state, up or down
| ButtonMomentary | ||
timeToRepeatHandler(te:TimerEvent):void
Called when time elapses that we should start repeating presses. | ButtonMomentary |
Event | Summary | Defined By | ||
---|---|---|---|---|
Default event name of event generated when component is inactive (enabled == false) and any other event (press, release, rollover, etc.) would have been invoked. | ButtonMomentary | |||
Default event generated when user presses the button. | ButtonMomentary | |||
Default event name of event generated when user releases the button and the cursor is within the button's hit area. | ButtonMomentary | |||
Default event name of event generated when user releases the button and the cursor is outside the button's hit area. | ButtonMomentary | |||
Default event name of event generated when user moves the cursor from the button's hit area to away from the hit area. | ButtonMomentary | |||
Default event name of event generated when user moves the cursor over the button's hit area. | ButtonMomentary |
_defaultButtonDownClassName | property |
protected var _defaultButtonDownClassName:String = ButtonMomentaryDefaultDown
_defaultButtonUpClassName | property |
protected var _defaultButtonUpClassName:String = ButtonMomentaryDefaultUp
_showHand | property |
protected var _showHand:Boolean = true
butDownSkin | property |
protected var butDownSkin:Sprite
Sprite containing the button down skin.
buttonContainer | property |
protected var buttonContainer:Sprite
Sprite container used for scaling button easily.
butUpSkin | property |
protected var butUpSkin:Sprite
Sprite containing the button up skin.
defaultButtonDownClassName | property |
defaultButtonDownClassName:String
Property for changing the graphics (skin) of the button's down (pressed) state. The default value is ButtonMomentaryDefaultDown
.
To change the skin, create a Sprite or MovieClip class, exporting for ActionScript, and enter the name here.
public function get defaultButtonDownClassName():String
public function set defaultButtonDownClassName(value:String):void
defaultButtonUpClassName | property |
defaultButtonUpClassName:String
Property for changing the graphics (skin) of the button's up (unpressed) state. The default value is ButtonMomentaryDefaultUp
.
To change the skin, create a Sprite or MovieClip class, exporting for ActionScript, and enter the name here.
public function get defaultButtonUpClassName():String
public function set defaultButtonUpClassName(value:String):void
evtDisabled | property |
public var evtDisabled:String = onDisabled
Event name of disabled event (when button clicked but button has enabled == false). The event names should really only be set at the time the component is instantiated (either at run-time, or programmatically). However, you can change it at any time programmatically and the component will use that event name.
evtPress | property |
public var evtPress:String = onPress
Event name of onPress event. The event names should really only be set at the time the component is instantiated (either at run-time, or programmatically). However, you can change it at any time programmatically and the component will use that event name.
evtRelease | property |
public var evtRelease:String = onRelease
Event name of onRelease event. The event names should really only be set at the time the component is instantiated (either at run-time, or programmatically). However, you can change it at any time programmatically and the component will use that event name.
evtReleaseOutside | property |
public var evtReleaseOutside:String = onReleaseOutside
Event name of onReleaseOutside event. The event names should really only be set at the time the component is instantiated (either at run-time, or programmatically). However, you can change it at any time programmatically and the component will use that event name.
evtRollOut | property |
public var evtRollOut:String = onRollOut
Event name of onRollOut event. The event names should really only be set at the time the component is instantiated (either at run-time, or programmatically). However, you can change it at any time programmatically and the component will use that event name.
evtRollOver | property |
public var evtRollOver:String = onRollOver
Event name of onRollOver event. The event names should really only be set at the time the component is instantiated (either at run-time, or programmatically). However, you can change it at any time programmatically and the component will use that event name.
pulseFreq | property |
public var pulseFreq:int = 100
Sets the interval (in milliseconds) between repeated onPress when the button is pressed. The
first interval begins after the waiting period (wait4Start
).
repeaterInstance | property |
protected var repeaterInstance:Timer
Timer used internally to implement repeater behavior.
repeatPressQuiet | property |
protected var repeatPressQuiet:Boolean
If true, repeated presses are quiet (no evtPress generate), false is regular (evtPress generated)
showHand | property |
showHand:Boolean
Boolean property indicating whether or not to display the hand cursor when the cursor is over this component.
public function get showHand():Boolean
public function set showHand(value:Boolean):void
timeUntilRepeat | property |
protected var timeUntilRepeat:Timer
Timer instance for waiting while mouse is down until we start repeating.
wait4Start | property |
public var wait4Start:int = 250
Sets the duration (in milliseconds) to wait after the user has pressed the left mouse button and before the button begins to repeat the onPress event. Note that one onPress event is generated immediately when the user first presses the button. If this value is 0, then the button does not repeat onPress events.
ButtonMomentary | () | Constructor |
public function ButtonMomentary()
changeDownSkin | () | method |
protected function changeDownSkin():void
changeUpSkin | () | method |
protected function changeUpSkin():void
configUI | () | method |
override protected function configUI():void
configUI Get the display objects created in preparation of launch. Note that we get called before our constructor, before strings and before we are notified that we are on the stage!
destroy | () | method |
public function destroy():void
Releases the listeners and any memory associated with the component.
disabled | () | method |
protected function disabled(val:String, q:Boolean = false):void
Generates onDisabled event.
Parameters
val:String | |
q:Boolean (default = false )
|
draw | () | method |
override protected function draw():void
execEvent | () | method |
public function execEvent(evtName:String, evtVal:* = null, q:Boolean = false):void
This method is used to programmatically invoke an action of the component based on the event passed in. When a user invokes an action, like presses a button, the button generates an onPress event. This method does the opposite -- given an onPress event, this the method visually depresses the button. This is typically used to simulate the user invoking the action (like our event recorder/playback component).
Parameters
evtName:String — Event name (string) must match the event this component generates
| |
evtVal:* (default = null ) — Event value (for momentary button, this value is ignored)
| |
q:Boolean (default = false ) — Boolean true to invoke action without generating the event, false or not given at all to allow event to be generated
|
generateEvent | () | method |
protected function generateEvent(type:String, q:Boolean):void
Generates the given event type passed in.
Parameters
type:String | |
q:Boolean |
mouseDown | () | method |
protected function mouseDown(me:MouseEvent):void
When mouse clicked, do the button press action.
Parameters
me:MouseEvent |
mouseRollOut | () | method |
protected function mouseRollOut(me:MouseEvent):void
Mouse leaves button hit area.
Parameters
me:MouseEvent |
mouseRollOver | () | method |
protected function mouseRollOver(me:MouseEvent):void
Mouse rolls over button hit area.
Parameters
me:MouseEvent |
mouseUp | () | method |
protected function mouseUp(me:MouseEvent):void
Mouse is released; release the button and stop the repeater or any stage we're at, as well.
Parameters
me:MouseEvent |
mouseUpHandlerForReleaseOutside | () | method |
protected function mouseUpHandlerForReleaseOutside(me:MouseEvent):void
Catches 'mouse up' when the mouse is released (inside the button or outside).
Parameters
me:MouseEvent |
press | () | method |
protected function press(q:Boolean = false):void
Called when button pressed, we generate the onPress event and setup mechanism to see if we should repeat.
Parameters
q:Boolean (default = false )
|
release | () | method |
protected function release(q:Boolean = false):void
Button is released, stop anything dependent on that and generate the onRelease event.
Parameters
q:Boolean (default = false )
|
releaseOutside | () | method |
protected function releaseOutside(q:Boolean = false):void
Button released with mouse outside the hit area of the button. Process the release.
Parameters
q:Boolean (default = false )
|
repeatPressHandler | () | method |
protected function repeatPressHandler(te:TimerEvent):void
Called on each repetition while repeater is active.
Parameters
te:TimerEvent |
rollout | () | method |
protected function rollout(q:Boolean = false):void
Generates onRollOut event.
Parameters
q:Boolean (default = false )
|
rollover | () | method |
protected function rollover(q:Boolean = false):void
Generates onRollOver event.
Parameters
q:Boolean (default = false )
|
setDown | () | method |
protected function setDown(buttonState:Boolean):void
Sets the graphics to the appropriate visual state, up or down
Parameters
buttonState:Boolean |
timeToRepeatHandler | () | method |
protected function timeToRepeatHandler(te:TimerEvent):void
Called when time elapses that we should start repeating presses.
Parameters
te:TimerEvent |
onDisabled | Event |
Default event name of event generated when component is inactive (enabled == false
) and any other event (press, release, rollover, etc.) would have been invoked.
Event value (data) tells the target which event (a string).
onPress | Event |
Default event generated when user presses the button.
onRelease | Event |
Default event name of event generated when user releases the button and the cursor is within the button's hit area.
onReleaseOutside | Event |
Default event name of event generated when user releases the button and the cursor is outside the button's hit area.
onRollOut | Event |
Default event name of event generated when user moves the cursor from the button's hit area to away from the hit area.
onRollOver | Event |
Default event name of event generated when user moves the cursor over the button's hit area.