2

在尝试使用从 Flash CS5 导入的“swc”文件时,我遇到了一个非常奇怪的问题,我试图在 Flex Builder 3 中使用该文件(通过将符号转换为“Flex 组件”)。错误出现在与我正在导入的“swc”文件无关的文件中。

现在,我知道自动化的东西已经成为 FB4 的一部分,但我真的没有选择迁移到 FB4。

我曾尝试更改 Flash CS5 中的 flex sdk 设置(下面给出的步骤),但这并没有帮助。Edit-->Preferences-->Actionscript-->"Actionscript 3.0 Settings"-->"Flex SDK Path"(指向flex3.5 sdk而不是Flex4.0 sdk)

我觉得这个问题很可能是 Flex 3 和 Flex 4 的兼容性问题,但无法找到相同的解决方法。任何帮助是极大的赞赏。

谢谢,卡皮尔

这是跟踪:

Severity and Description    Path    Resource    Location    Creation Time   Id
1044: Interface method createAutomationIDPartWithRequiredProperties in namespace mx.automation:IAutomationObject not implemented by class com.sparsha.view.ui:SchematicWindow.
1044: Interface method createAutomationIDPartWithRequiredProperties in namespace mx.automation:IAutomationObject not implemented by class 
1044: Interface method get automationEnabled in namespace mx.automation:IAutomationObject not implemented by class com.sparsha.lib.controls:CloseableTabBar.    
1044: Interface method get automationEnabled in namespace mx.automation:IAutomationObject not implemented by class 
1044: Interface method get automationEnabled in namespace mx.automation:IAutomationObject not implemented by class com.sparsha.lib.layouts:DockedAppLayout. 
4

2 回答 2

0

好的,首先,错误:这意味着 Flash 可能为您使用某个模板导入的符号生成了一个类,其中该模板不适合您用于编译项目的 SDK。具体来说,生成的类没有实现错误消息中列出的方法。即你的 framework.swc 有一个 mx.automation:IAutomationObject 的定义,它有方法 createAutomationIDPartWithRequiredProperties() (好名字顺便说一句),但 Flash 生成的代码读作

package com.sparsha.view.ui {
import mx.automation:IAutomationObject;
public class SchematicWindow implements IAutomationObject { . . . } }

由于您无法对 Flash 不生成所需的方法做任何事情,因此您唯一的方法是对 SDK 进行猴子补丁。即,将 mx/automation/IAutomationObject.as 从 SDK 源复制到项目的类路径。删除冲突的方法声明(这可能会也可能不会导致其他错误)。如果它导致进一步的错误,请对每个“行为不端”的类重复相同的过程......

但是,monkeypatching 将意味着您不再能够使用框架 RSL,因为它们将随原始版本一起提供。所以,我会尝试完全避免这个问题,并寻找另一种从 Flash IDE 中导出符号的方法,例如,不将它们设为 Flex 组件。或者,如果你真的坚持它们是一个 Flex 组件,然后引导 FlexSprite,例如,并将你的 Flash 符号分配给引导类作为“父类”。

于 2011-10-11T18:38:30.483 回答
0

我最近也遇到了这个问题。当我将 flash 生成的 swc 包含在我的 flex 项目 lib 文件夹中时,我会收到错误消息。

通过将我的 flex 升级到 flex 4.5.1.21328A SDK,我能够解决这个问题。

关于我的项目可能对其他人有所帮助的其他详细信息:我的 swc 是从 Flash Professional CS5.5 生成的,而我的 Flex 项目正在 Flash Builder 4.5 中使用。

我的 swc 使用 ActionScript 3.0 发布到 Flash Player 9。我的 flex 项目使用的是 3.5.0.12683 SDK。

于 2012-03-30T17:13:25.730 回答