DelayButtonBehavior
Kind of class: | public class |
---|---|
Package: | |
Inherits from: |
|
Classpath: | org.asaplibrary.ui.buttons.DelayButtonBehavior |
File last modified: | Wednesday, 11 May 2011, 18:43:34 |
Delegate class to manage timing control over mouse over and mouse out events. This is useful for navigation menus where the menu items should "remember" its state for a brief moment even when the mouse has moved out of its click region. In interface design this effect is called hysteresis - see also www.mackido.com/Interface/hysteresis.html">time delay in hierarchical menus.
Another use is to prevent buttons to activate when the mouse moves very quickly over them. A activation delay will cause the button to activate only when the mouse stays for a little bit longer.
3 timing properties that can be set:
- indelay : the number of seconds between the mouse having rolled over and the button activation
- outdelay : the number of seconds between the mouse having moved out and the clip performing its mouse out activation
- afterdelay : the number of seconds a button is momentarily inactive after mouse out
Example
-
import org.asaplibrary.ui.buttons.*; public class MyButton extends MovieClip { private var mDelegate:DelayButtonBehavior; public function MyButton () { mDelegate = new DelayButtonBehavior(this); mDelegate.addEventListener(ButtonStateDelegateEvent.UPDATE, update); // set the timing: indelay = .1; outdelay = .5; } private function update (e:ButtonStateDelegateEvent) : void { if (e.state == ButtonStates.OVER) grow(); if (e.state == ButtonStates.OUT) shrink(); } }
Summary
Constructor
-
DelayButtonBehavior
(inButton:MovieClip)
- Creates a new DelayButtonBehavior.
Instance properties
-
indelay
: Number
- /
-
outdelay
: Number
- (Hysteresis) delay before mouse out action is performed, in seconds.
-
afterdelay
: Number
- Delay after mouse out until the button is activated (enabled) again, in seconds.
Constructor
DelayButtonBehavior
function DelayButtonBehavior(inButton:MovieClip)
Creates a new DelayButtonBehavior.
Parameters
inButton:the owner button
Instance properties
afterdelay
afterdelay:Number(read,write)
Delay after mouse out until the button is activated (enabled) again, in seconds.
indelay
indelay:Number(read,write)
/ override public function toString() : String { return getQualifiedClassName(this); } / Delay before mouse over is performed, in seconds.
outdelay
outdelay:Number(read,write)
(Hysteresis) delay before mouse out action is performed, in seconds.