僕の知らない構文
FLASH-JPにて。ソース自体はAS2でしょうか。
僕は「Tween」や「Elastic」といったクラスの詳細は分からないのですが、本題はその部分じゃあなく。
import mx.transitions.Tween; var myTween:Tween = new Tween(test_mc, "_x", mx.transitions.easing.Elastic.easeOut, 0, 300, 3, true);http://www.flash-jp.com/modules/newbb/viewtopic.php?viewmode=flat&topic_id=6888&forum=6
というコードを
import mx.transitions.Tween; mx.transitions.easing.Elastic; // とにかくアクセス a = "Elastic"; var myTween:Tween = new Tween(test_mc, "_x", mx.transitions.easing[a].easeOut, 0, 300, 3, true);http://www.flash-jp.com/modules/newbb/viewtopic.php?viewmode=flat&topic_id=6888&forum=6
とも書けるようです。
パッと見たところ、「this["child"]._x」のごとく、クラスへも「[]」を使ってアクセスできるのではないかと。
以前からクラス名の文字列を渡して、そのクラスのインスタンスを返す方法を探していましたが、もしかしたらヒントになるのかもしれません。
AS3で、
new flash.display["Sprite"]();
みたいなことはできないのかしら?
ちなみに上記のコードはエラーでコンパイルが通りません。
# (2007/08/18)
分かりました。