Flash 错误 #1034:使用 Flash Develop 运行时类型强制失败
我已经编译了一个 SWC 并在 flashdevelop 项目中使用它。
当我编译项目时,一切都很好,但是当我运行/调试项目时,我得到:
[Fault] exception, information=TypeError: Error #1034: Type Coercion failed: cannot convert flash.display::MovieClip@43e3f99 to fl.controls.Button.
以下行导致了错误:
public var loginPanel:loginControl = new loginControl();
LoginControlView 是影片剪辑名称。 loginControlView 是资产名称。 并且有一个名为 LoginControl 的类,它扩展了 loginControlView
LoginControlView 影片剪辑包含 2 个文本框和一个按钮 (fl.controls)
如果我从 Flash IDE 编译/运行/调试,该项目运行正常。
有什么建议吗?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
好吧,我找到了解决方案。我的类路径中包含 Flash 安装的 fl.controls 文件夹的路径。但 fl.controls 也与我的 SWC 一起导出。
我认为同一类的两个定义导致了问题,因为当我删除类路径时,一切都工作正常。
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.
您可能知道,fl.controls 包包含 Flash Professional CS5 及更早版本的组件,可以通过将组件捆绑在 .swc 中来在 Flash 开发中使用这些组件:如何在 FlashDevelop 中使用 fl.controls.* 中的 Adobe 控件?
由于您的项目在 Flash Professional 中编译没有错误,因此问题必定出在导出的 fl.controls.* .swc 中。
由于您使用的是 Flash Develop,因此您可以使用 spark.controls 包 或 mx.controls 包。这两个包都包含 Button 和 TextInput 类。
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.