我有一个 McContainer 类,如下所示:
package
{
import flash.display.MovieClip;
public class McContainer extends MovieClip
{
public var body_Mc:MovieClip;
public function McContainer()
{
}
}
}
现在我想将一个 MovieClip 强制转换为 McContainer :
var a:MovieClip
var b:AppContainer
b= AppContainer(a) ;
trace(a);
但我得到运行时错误:
TypeError: Error #1034: Type Coercion failed: cannot convert
flash.display::MovieClip@2bdbe041 to McContainer.
at Untitled_fla::MainTimeline/frame1()
如何将 MovieClip 强制转换为 McContainer ?