1
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:找不到类型或不是编译时常量:结果{或故障}事件。”

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

这是在 CS5.5 中

4

2 回答 2

0

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

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

然后添加这个路径:

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

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

于 2013-06-04T16:04:31.960 回答
0

ResultEvent/FaultEvent are Flex classes, not base Flash classes. In order to use them, you'll need to be using the Flex framework.

If you follow the provided links, Adobe's language reference tells you:

Language Version: ActionScript 3.0
Product Version: Flex 3
Runtime Versions: Flash Player 9, AIR 1.1


This Adobe reference on Flash projects should point you in the right direction for using Flex SDK classes in Flash CS5. (look aaaaaaall the way down at the bottom)

于 2012-06-27T17:18:32.950 回答