setInterval関数2 : ActionScript
setInterval関数の覚書
タイマーを宣言したオブジェクトを削除してもclearIntervalでクリアしないと実効は停止しない。
function Custom() {
this.prop = 'プロパティ';
this.timer;
var f = function () {
trace('タイマー');
};
this.start = function() {
this.timer = setInterval(f, 5);
}
}
var o = new Custom();
o.start();
delete o; // オブジェクトを削除しても実効は停止されない。
o.timer; // オブジェクトが削除されているのでタイマーを停止できない(タイマーを停止する方法がなくなる)。
コメントはまだありません。
コメントの投稿
改行と段落タグは自動で挿入されます。メールアドレスは表示されません。
利用可能な HTML タグ :
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite="">
<cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>