Question

I try to connect blazeDS in actionscript project with the following code:

    ro = new RemoteObject();
    var cs:ChannelSet = new ChannelSet(); 
    cs.addChannel(new AMFChannel("my-amf", "http://localhost:8080/Ninja/messagebroker/amf"));
    ro.channelSet = cs;
    ro.destination = "test"; 
    ro.source = "me.qiankanglai.test";

    ro.addEventListener(ResultEvent.RESULT,r1);
    ro.addEventListener(FaultEvent.FAULT,r2);
    ro.sayHello();

But I cannot connect the server. I make a new flex project and the works well. I use chrome to see the connection detail(Request Payload are different from the very beginning)

The actionscript project: as pro

The flex project:

flex pro

In fact, I got an error from the actionscript project:

    TypeError: Error #1034: Type Coercion failed: cannot convert Object@5bec0b9 to mx.messaging.messages.ErrorMessage.

I don't know what's the differenct between these two ways of remoteobject.

Was it helpful?

Solution

I just found the solution in the right part of my question(related questions):

Using RemoteObject (AMF) from a Flash or Pure AS3 Project

I just need one line:

RpcClassAliasInitializer.registerClassAliases();

In this field, stackoverflow is more powerful than Google!

OTHER TIPS

I think that you can also use the metadata tag [RemoteClass], but I'm not entirely sure of what you wanna do.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top