メソッドと関数
ActionScript2.0のメソッドと関数の覚書。
class Custom
{
public function m1(){
trace("m1 : " + this); ----- 自身を表示
function f(){
trace("f : " + this); ----- undefinedを表示
}
f();
m2();
}
function m2(){
trace("m2 : " + this); ----- 自身を表示
}
}
var c = new Custom();
c.m1();
入れ子の関数でthisを表示する
class Custom
{
public function m1(){
trace("m1 : " + this); ----- 自身を表示
function f(self){
trace("f : " + self); ----- 自身を表示
}
f(self);
m2();
}
function m2(){
trace("m2 : " + this); ----- 自身を表示
}
}
var c = new Custom();
c.m1();
スポンサード リンク
この記事にはまだコメントがついていません。
コメントの投稿
段落や改行は自動挿入です。メールアドレスはサイト上では非表示です。
使用できる HTML タグ: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>

