記事見出し索引
メソッドと関数
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=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>
