RepeatButton?クラス
- ボタンのリピート処理を行うためのヘルパークラスです。
コード
- http://snippets.libspark.org/svn/as3/RepeatButton/src/com/voidelement/display/RepeatButton.as 以下にあります。
使い方
リピートボタン化したい InteractiveObject? (主にSpriteやSimpleButton?)と、リピート開始時間およびリピート間隔をコンストラクタに渡します。
ボタン処理はそれぞれ用意されたメソッドに代入することで定義できます。
// button_spriteに対して、500ミリ秒経過したら100ミリ秒単位でリピート処理を行うボタン機能を持たせる
var rb:RepeatButton = new RepeatButton( button_sprite, 500, 100 );
// ボタン押下時処理定義
rb.onPress = function():void {
trace("repeat button : press");
}
// リピート処理定義
rb.onRepeat = function():void {
trace("repeat button : repeat");
}
// ボタン押上時処理定義
rb.onRelease = function():void {
trace("repeat button : release");
}
