root/as2/Endflow/src/net/endflow/util/Delay.as

リビジョン 78, 1.3 kB (コミッタ: kuy, コミット時期: 1 年 前)

KeyIf?.as 0.2.0 Keyクラスで定義されていないキーコード指定にも対応。
Delay.as 0.1.0 初版。サンプルで必要になったので。

Line 
1 /*
2  * Copyright(c) 2007 Yuki KODAMA [endflow.net]
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
13  * either express or implied. See the License for the specific language
14  * governing permissions and limitations under the License.
15  */
16
17 /**
18  * Delayクラス
19  *
20  * @description 指定した時間だけ関数実行を遅延させる
21  * @author              Yuki KODAMA [endflow.net]
22  * @since               Flash Player 8 (ActionScript 2.0)
23  * @version             0.1.0
24  * @link                http://snippets.libspark.org/trac/wiki/kuy/Delay
25  * @history             [0.1.0] 2007-09-15: Snippets Project に公開。
26  */
27 class net.endflow.util.Delay {
28         public static function f(callback:Function, delay:Number, _this):Void {
29                 // Lispみたいにまだ使われてないシンボルを簡単に取得したい!!!
30                 callback.__ef_tmr__ = setInterval(function(){
31                         clearInterval(callback.__ef_tmr__ );
32                         callback.call(_this);
33                 }, delay);
34         }
35 }
Note: リポジトリブラウザについてのヘルプは TracBrowser を参照してください。