0
我想創建一個非常基本的Flash遊戲,使用Tom Krcha的P2P遊戲庫,我發現here,我遇到的唯一問題是當我嘗試實現該類時,出現錯誤當我嘗試啓動應用程序,P2P Flash遊戲#1009錯誤
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at Logger$/log()[C:\_DEV\P2PGameEngine\src\Logger.as:20]
at P2PGame/onConnect()[C:\_DEV\P2PGameEngine\src\P2PGame.as:54]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at com.adobe.fms::P2PSession/onNetGroupConnect()[C:\_DEV\P2PMessengerLib\src\com\adobe\fms\P2PSession.as:208]
at com.adobe.fms::P2PSession/netStatus()[C:\_DEV\P2PMessengerLib\src\com\adobe\fms\P2PSession.as:312]
這裏是我的Flash Builder代碼,
<?xml version="1.0" encoding="utf-8"?>
<s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
width="520" height="391"
applicationComplete="init()">
<fx:Script>
<![CDATA[
private var game:P2PGame;
private const SERVER:String = "rtmfp://p2p.rtmfp.net/";
private const DEVKEY:String = "DEV_KEY_HERE";
protected function init():void
{
var usr:String = "user"+(Math.round(Math.random()*1000));
game = new P2PGame(SERVER+DEVKEY,"my_group");
game.addEventListener(Event.CONNECT, onGameConnect);
game.connect(usr);
}
private function onGameConnect(event:Event):void{
main_log.text += "P2P connection successfull..."
}
]]>
</fx:Script>
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<s:TextArea id="main_users" x="346" y="10" width="164" height="371" color="#FFFFFF"
contentBackgroundColor="#000000" text="ACTIVE USERS" textAlign="center"
textDecoration="underline" verticalAlign="top"/>
<s:TextArea id="main_log" x="10" y="10" width="328" height="371"/>
</s:WindowedApplication>
任何想法,爲什麼這可能發生?我已經包括了圖書館,但我仍然有這個錯誤,有什麼想法?
在此先感謝!
我剛剛剛剛下載了最新版本的庫。所以我懷疑它可能是... – Odyss3us
是的,它是...看到我的編輯。 – weltraumpirat
好東西,看起來就像是你說的'SWC',我下載並重新包含了庫項目文件,將版本更改爲'10.2.0',然後將其包含到我的項目的構建路徑中,成功了!謝謝您的幫助! – Odyss3us