0
votes

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?

2
What happens if you remove the button from the LoginControlView movieclip? Are there any other errors displayed or does it work fine? - Maurycy
@Maurycy I get another similar error regarding the fl.controls.TextInput - Dve
Hmm, have you tried compiling this under Flex/Flash Builder? - Maurycy
Does flash develop not use the flex compiler?? the line 'Using the Flex Compiler Shell' in the flexdev output window suggests so!? - Dve

2 Answers

4
votes

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.

0
votes

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.