【问题标题】:.as 1046: Type was not found...:ResultEvent and FaultEvent.as 1046:找不到类型...:ResultEvent 和 FaultEvent
【发布时间】:2012-06-27 17:11:34
【问题描述】:
import mx.rpc.soap.*;
import mx.rpc.AbstractOperation;
import mx.rpc.events.FaultEvent;
import mx.rpc.events.ResultEvent;

public class MainDocument extends MovieClip {

    something.addEventListener(FaultEvent.FAULT, DisplayError);

    somethingElse.addEventListener(ResultEvent.RESULT, ParseGameSources);

    function DisplayError(evt:FaultEvent):void{
       //do something
    }

    function ParseGameSources(evt:ResultEvent):void{
       //do something
    }
}

我总共有 6 个函数使用 ResultEvent 或 FaultEvent,就像上面的 2 个一样,它们都得到错误“1046:Type was not found or is not a compile-time constant: Result{or Fault}Event.”

我遇到的每个答案都只是说要导入,我已经在导入。

这是在 CS5.5 中

【问题讨论】:

    标签: actionscript flash-cs5


    【解决方案1】:

    ResultEvent/FaultEvent 是 Fl​​ex 类,而不是基本 Flash 类。为了使用它们,您需要使用 Flex 框架。

    如果您点击提供的链接,Adobe 的语言参考会告诉您:

    语言版本:ActionScript 3.0
    产品版本:Flex 3
    运行时版本:Flash Player 9、AIR 1.1


    This Adobe reference on Flash projects 应该为您指明在 Flash CS5 中使用 Flex SDK 类的正确方向。 (一直往下看啊啊啊)

    【讨论】:

      【解决方案2】:

      我能够在 Adob​​e Flash CS6 中使用以下方法解决此问题:

      文件 > 发布设置 >(脚本:Actionscript 3.0)“扳手图标”> 库路径选项卡 > 单击“+”(加号)图标以添加新项目。 > 点击(文件夹图标)浏览到路径 >

      然后添加这个路径:

      Program Files\Adobe\Adobe Flash Builder 4.7(64 位)\sdks\4.6.0\frameworks\libs

      这将使您的 swf 文件大小增加约 150kb,但现在您可以编译了!

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2012-03-17
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多