Flash Error #1034: Type Coercion failed when running with Flash Develop
-
10-10-2019 - |
문제
I have compiled an SWC and am using it in a flashdevelop project.
When I compile the project all is fine, but when I run/debug the project I get:
[Fault] exception, information=TypeError: Error #1034: Type Coercion failed: cannot convert flash.display::MovieClip@43e3f99 to fl.controls.Button.
The following line is causing the fault:
public var loginPanel:loginControl = new loginControl();
LoginControlView is the movieclip name. loginControlView is the asset name. and there is a class called loginControl that extends loginControlView
The LoginControlView movieclip contains 2 textboxes and a button (fl.controls)
The project runs fine if I compile/run/debug from the Flash IDE.
Any suggestions?
해결책
Ok I found a solution. Included in my classpaths was a path to the fl.controls folder of the flash install. But the fl.controls where also being exported with my SWC. I assume having two definitions of the same class was causing the problem, because when I removed the classpath all worked fine.
다른 팁
as you probably know, fl.controls package contains components for Flash Professional CS5 and earlier which can be used in Flash Develop by bundling the components in a .swc: How do I use an Adobe control from fl.controls.* in FlashDevelop?
since your project compiles in Flash Professional without error the problem must lie within the exported fl.controls.* .swc.
instead of using an fl.contros.* .swc, since you're using Flash Develop, you could use the spark.controls package or mx.controls package from the Flex 4.1 SDK. both packages include a Button and TextInput classes.