I am new to Merapi. I created a helloworld AIR app and java and I used
merapi to connect them. my apps are shown below,
Java:
import merapi.Bridge;
import merapi.messages.Message;
import merapi.messages.IMessage;
import merapi.messages.IMessageHandler;
public class hello {
/**
* @param args
*/
public static void main(String[] args)throws Exception {
// TODO Auto-generated method stub
Bridge br = Bridge.getInstance();
Message m=new Message();
m.setData("hello");
br.sendMessage(m);
}
}
AIR :
?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication
xmlns:mx="
http://www.adobe.com/2006/mxml"
xmlns:merapi="merapi.*"
layout="vertical" verticalAlign="top" horizontalAlign="center">
<mx:Script>
<![CDATA[
import merapi.messages.Message;
import merapi.messages.IMessage;
import mx.rpc.events.ResultEvent;
import mx.controls.Alert;
private function handleResult(event : ResultEvent) : void
{
var message : IMessage = event.result as IMessage;
var message1 : Message = event.result as Message;
lb1.text = message1.data as String;
}
]]>
</mx:Script>
<merapi:BridgeInstance id="bridge" result="handleResult(event);"/>
<mx:Label id="lb1" width="301" height="28"/>
</mx:WindowedApplication>
I first run the java application and then run the air application but
when running the air I got error Cannot access a property or method of
a null object reference.
TypeError: Error #1009: Cannot access a property or method of a null
object reference.
at merapi::BridgeInstance()[/Users/adam/dev/os/merapi/svn/branches/
private-beta-v2/core/flex/merapi-core/src/merapi/BridgeInstance.as:83]
at helloAIR/_helloAIR_BridgeInstance1_i()[D:\prjt_v1\helloAIR\src
\helloAIR.mxml:31]
at helloAIR()[D:\prjt_v1\helloAIR\src\helloAIR.mxml:31]
at _helloAIR_mx_managers_SystemManager/create()
at mx.managers::SystemManager/initializeTopLevelWindow()[C:\autobuild
\3.2.0\frameworks\projects\framework\src\mx\managers\SystemManager.as:
3188]
at mx.managers::SystemManager/
http://www.adobe.com/2006/flex/mx/
internal::docFrameHandler()[C:\autobuild\3.2.0\frameworks\projects
\framework\src\mx\managers\SystemManager.as:3064]
at mx.managers::SystemManager/docFrameListener()[C:\autobuild
\3.2.0\frameworks\projects\framework\src\mx\managers\SystemManager.as:
2916]
I wonder why is it?
anybody know the reason of this error?
really need a help.