AS3通过类名获取类引用
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了AS3通过类名获取类引用相关的知识,希望对你有一定的参考价值。
package { import flash.display.Sprite; import flash.utils.getDefinitionByName; public class DynamicCall extends Sprite { public function DynamicCall() { var ClassReference:Class = getDefinitionByName("String") as Class; var s:String = (new ClassReference("foo=") as String); trace(s); } } } // This basically creates an instance of the String class, from the // class name 'String'. getDefinitionByName takes the entire class // path, so if you wanted to create an instance of MovieClip, you would // provide the entire path: // var ClassReference:Class = getDefinitionByName("flash.display.MovieClip") as Class;
以上是关于AS3通过类名获取类引用的主要内容,如果未能解决你的问题,请参考以下文章