Actionscript 3:函数变量中的类构造函数?

时间:2013-03-10 21:25:26

标签: function variables actionscript constructor

我想让一个变量保持一个类构造函数,但是它给出了这个错误:

var myFunction:Function
function someFunction() {}

myFunction = someFunction //works
myFunction = MovieClip    //doesn't work - 1067: Implicit coercion of a value of type Class to an unrelated type Function.

有办法吗?

1 个答案:

答案 0 :(得分:3)

举办课程的正确类型是Class,而不是Function

var myClass:Class = MovieClip;