Hi,

The nekoserver package is never tested with a Flex client, so I am sure it has 
problems with it. Additionally, it currently only works with its appropriate 
client code – nekoserver.client.NekoServerConnection.

So what I propose you to do is the following:

-          Compile a nekoserver client to AS3

o   Make a class like Main.hx with empty main function and import 
nekoserver.client.NekoServerConnection

o   Compile it to as3: haXe –main Main –lib nekoserver –as3 output

-          Put the generated as3 files into your flex sources folder

-          Instead of Flex Messaging, use 
nekoserver.client.NekoServerConnection.urlConnect()

Try it… and you can reply me in Russian if you like ☺

Mike

From: [email protected] 
[mailto:[email protected]] On Behalf Of Владимир Чуйков
Sent: Friday, May 28, 2010 1:26 AM
To: [email protected]
Subject: [Neko] Problem with mx:RemoteObject (Flex) and Neko

I make simple server:


// Index.hx
package;
import neko.Lib;
import nekoserver.amf.AmfHandler;
import nekoserver.io.ResponseOutput;
import nekoserver.RemotingServer;

class Index
{
public function new() { }

  public function echo(s: String): String {
  return s;
}

static function main() {

  var server:RemotingServer = new RemotingServer();

  server.addHandler(new AmfHandler(true));

  server.addObject("Index", new Index());

  if (server.handleRequest())

    return;

  Lib.print("remoting server");
}
}


and simple Flex client:


<?xml version="1.0" encoding="utf-8"?>

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"; layout="absolute" 
width="800" height="600" creationComplete="Init()" >

<mx:Script>
<![CDATA[
import mx.controls.Alert;
import flash.net.NetConnection;
import flash.net.ObjectEncoding;
import flash.net.Responder;

private function Init(): void {
  //testNetConnection();
  testRemoteObject();
}

private function testNetConnection():void {
  var responder: Responder = new Responder(onSuccess, onError);
  var netConnection: NetConnection = new NetConnection();
  netConnection.objectEncoding = ObjectEncoding.AMF3;
  netConnection.connect("http://localhost:2000/index.n";);
  netConnection.call("Index.echo", responder, "test");
}

private function onError(response:Object):void {
  Alert.show(String(response), "Error");
}

private function onSuccess(response:Object):void {
  Alert.show(response[0], "Response");
}

private function testRemoteObject():void {
  echoService.echo("test");
}
]]>
</mx:Script>

<mx:RemoteObject id="echoService" destination="Index" 
source="http://localhost:2000/index.n"; 
fault="Alert.show(event.fault.faultString, 'Error');">
  <mx:method name="echo" result="Alert.show(event.result.toString(), 
'Response');" />
</mx:RemoteObject>
</mx:Application>



When function 'testNetConnection' called, server correctly response, all ok.
When using mx:RemoteObject, then get the error:

[MessagingError message='Destination 'Index' either does not exist or the 
destination has no channels defined (and the application does not define any 
default channels.)']

How i can using RemoteObject with Neko server?
-- 
Neko : One VM to run them all
(http://nekovm.org)

Reply via email to