gpt4 book ai didi

javascript - 如何成功地将 AppWarp 集成到 ActionScript 3 代码中?

转载 作者:行者123 更新时间:2023-11-30 17:38:44 24 4
gpt4 key购买 nike

我想为 Facebook 创建 flash 多人游戏。我已经完成了游戏代码,只是我不知道如何正确集成 AppWarp

我在 AppHq 上创建了应用程序,有 Api 和 key ,还创建了房间,我有房间 ID。

当在我的主类 ActionScript 3.0 代码中我尝试使用这个:

    public class Script extends MovieClip
{
public var roomID:String = "my room id";
private var apiKey:String = "my api key"
private var secretKey:String = "my secret";
private var listener:AppWarpListener;
}
public function Script()
{
WarpClient.initialize(apiKey, secretKey);
WarpClient.getInstance().setConnectionRequestListener(listener);
WarpClient.getInstance().setRoomRequestListener(listener);
WarpClient.getInstance().setNotificationListener(listener);
}

我遇到了错误(在 AppWarpListener.as 文件中):

1045: Interface ConnectionRequestListener was not found.
1045: Interface RoomRequestListener was not found.
1045: Interface NotificationListener was not found.

我关注了这个tutorial我下载了这个SDK . SDK 文件夹里面有很多版本的 swc,所以我安装了最新的:V_1.5.2 这里是文件 AppWarpLib.swc 我通过两种方式将它导入到 Adob​​e Flash CC:

By clicking Preferences (CTRL + U) > Code Editor > Action Script 3.0 Settings > Library path (I put here path to swc);

And By clicking publish settings SWC > Output file (here I select that swc)

但同样,我仍然遇到这些错误。

也许是因为我需要将代码文件保存在 FTP 上?我正在我的 PC 上测试它。

此外,在我在首选项中设置路径后,我收到了很多这样的警告:

`Line 1, Column 1   Warning: 5002: The frame scripts of the symbol 'Symbol 116' have been ignored because a compiled clip contains a definition for Game__fla.Symbol116_26. To override the Game__fla.Symbol116_26 definition, place a custom class file within your classpath.`

同样在我之前写的链接的 SDK 文件夹中是 sample 文件夹,但里面只有 .as 文件,我不知道如何在没有 .fla 文件的情况下尝试它。

那么你有什么想法吗?谢谢。

同样在我之前写的链接的 SDK 文件夹中是 sample 文件夹,但里面只有 .as 文件,我不知道如何在没有 .fla 文件的情况下尝试它。

我尝试创建新的空白 .fla 文件并将 Class 设置为 SpriteMoveDemo.as,但同样的问题我遇到了这些错误(在 AppWarpListener.as 文件中):

1045: Interface ConnectionRequestListener was not found.
1045: Interface RoomRequestListener was not found.
1045: Interface NotificationListener was not found.

那么你有什么想法吗?谢谢。

最佳答案

您必须定义一个监听器类来监听响应和通知。但在 Flash CC 中,您不能在 actions 中定义类。您需要创建一个外部 ActionScript 文件并在其中定义您的监听器类。然后转到文件 -> ActionScript 设置。在源路径部分下,添加保存新 ActionScript 文件的位置路径。

您应该仅通过单击首选项 (CTRL + U) > 代码编辑器 > Action Script 3.0 设置 > 库路径(我将 swc 的路径放在这里)来添加 appwarp .swc。

关于javascript - 如何成功地将 AppWarp 集成到 ActionScript 3 代码中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21490889/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com