我想为Facebook创建闪存多人游戏。我已经完成了游戏的代码,只是不知道如何正确地集成AppWarp。
我在AppHq上创建了应用程序,有Api和秘密密钥,还创建了房间和我有房间的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);
}I得到错误(在AppWarpListener.as文件中):
1045: Interface ConnectionRequestListener was not found.
1045: Interface RoomRequestListener was not found.
1045: Interface NotificationListener was not found.我跟踪这个教程并下载了这个SDK。在SDK文件夹中有许多版本的swc,所以我安装了最新版本: V_1.5.2这里是文件AppWarpLib.swc --我以两种方式将它导入Adobe:
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上?我正在用我的电脑测试它。
另外,在我在首选项中设置了路径之后,我收到了许多这样的警告:
`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.那你有主意了吗?谢谢。
发布于 2014-02-03 05:40:51
您必须定义一个侦听器类来侦听响应和通知。但是在闪存CC中,您不能在actions中定义类。您需要创建一个外部操作脚本文件,并在那里定义侦听器类。然后转到“文件-> ActionScript设置”。在“源路径”部分下,添加保存新操作脚本文件的位置的路径。
您应该通过单击Preferences (CTRL + U) > Code >ActionScript3.0设置>库路径(我将路径放置到swc)来添加appwarp .swc。
发布于 2014-03-31 11:08:16
该示例使用了较早版本的appwarp,但新版本包含了一些新方法和侦听器。
您所需要做的就是实现丢失的侦听器。
public function onInitUDPDone(res:int):void{}
public function onUserPaused(locid:String, isLobby:Boolean, username:String):void{}
public function onUserResumed(locid:String, isLobby:Boolean, username:String):void{}
public function onGameStarted(sender:String, roomid:String, nextTurn:String):void{}
public function onGameStopped(sender:String, roomid:String):void{}
public function onUpdatePeersReceived(update:ByteArray, isUDP:Boolean):void{}https://stackoverflow.com/questions/21490889
复制相似问题