Access keysTop, Summary, Constructors,
Class properties,
Instance properties,
Instance methodsAnimatingIndicator
| Kind of class: |
class |
| Inherits from: |
AnimatingSlider < Slider |
| Classpath: |
ui.AnimatingIndicator |
| File last modified: |
Monday, 06 November 2006, 08:09:10 |
import mx.transitions.easing.Regular;
import org.asapframework.util.actionqueue.ActionQueue;
import org.asapframework.util.actionqueue.AQMove;
import org.asapframework.util.watch.Watcher;
import ui.AnimatingSlider;
/**
Extended {@link AnimatingSlider} with percentage value text field.
This class uses a Watcher (<code>org.asapframework.util.watch.Watcher</code>) to update its text field according to the <code>_x</code> or <code>_y</code> position of the slider.
*/
class ui.AnimatingIndicator extends AnimatingSlider {
private static var ANIMATION_DURATION:Number = 1.4;
private var mWatcher:Watcher;
private var percentage_tf:TextField;
/**
*/
public function AnimatingIndicator () {
mDuration = ANIMATION_DURATION;
}
/**
Animates the knob to its new position.
*/
private function updatePosition (inX:Number, inY:Number) : Void {
if (!mIsInited) {
super.updatePosition(inX, inY);
mIsInited = true;
return;
}
var property:String;
var endValue:Number;
switch (mOrientation) {
case VERTICAL:
property = "_y";
endValue = inY;
break;
case HORIZONTAL:
property = "_x";
endValue = inX;
break;
}
mWatcher.stop();
if (property == undefined || endValue == undefined) {
return;
}
mWatcher = new Watcher(this, property, endValue, 1/30, true);
mWatcher.setCallback(this, "updateTextField");
mWatcher.start();
mMoveQueue.quit();
mMoveQueue = new ActionQueue();
mMoveQueue.addAction( AQMove.move, this, mDuration, _x, _y, inX, inY, Regular.easeOut);
mMoveQueue.addAction(mWatcher, mWatcher.stop);
mMoveQueue.run();
}
/**
*/
public function updateText () : Void {
updateTextField();
}
public function toString () : String {
return "ui.AnimatingIndicator";
}
// PRIVATE METHODS
/**
*/
private function updateTextField () : Void {
percentage_tf.text = String(Math.round(getValue()));
}
}
This class uses a Watcher (
org.asapframework.util.watch.Watcher) to update its text field according to the
_x or
_y position of the slider.
Constructor
AnimatingIndicator
function AnimatingIndicator (
)
Class properties
ANIMATION_DURATION
static private ANIMATION_DURATION:Number = 1.4
(read,write)
Instance properties
mWatcher
private mWatcher:Watcher
(read,write)
percentage_tf
private percentage_tf:TextField
(read,write)
Instance methods
toString
function toString (
) : String
updatePosition
private function updatePosition (
inX:Number,
inY:Number) : Void
Animates the knob to its new position.
updateText
function updateText (
) : Void
updateTextField
private function updateTextField (
) : Void