2011-01-07, 13:18
Hi!
I need to develop a custom interface with Flash and actionscript 2 (not AS3), but I am not able to figure it out how to send the json request to xbmc.
With loadVars.load() I can open an http connection to the server and, if the server need no other parameter, i can receive the json string and cast it into my object.
XBMC server needs to receive a json object with the call to obtain an answer.
With loadVars.sendAndLoad() I can send variables to the server in post mode, but I need to know the variable name that the xbmc server is expecting from my client.
All your examples stream the string (byte array) directly to the server immediately after opening a connection, but no variable name is specified.
Following you can see the 2 ways i tryed yet, obtaining only a -32700 parse error message, someone can help me with this?
and
I'am not able to use the tcp socket because AS2 needs a null char to terminate the string transmision and xbmc seems not sending a null char at the endo of the json strings.
Sorry for bad English!
Please help.
Thank you.
Bye!
I need to develop a custom interface with Flash and actionscript 2 (not AS3), but I am not able to figure it out how to send the json request to xbmc.
With loadVars.load() I can open an http connection to the server and, if the server need no other parameter, i can receive the json string and cast it into my object.
XBMC server needs to receive a json object with the call to obtain an answer.
With loadVars.sendAndLoad() I can send variables to the server in post mode, but I need to know the variable name that the xbmc server is expecting from my client.
All your examples stream the string (byte array) directly to the server immediately after opening a connection, but no variable name is specified.
Following you can see the 2 ways i tryed yet, obtaining only a -32700 parse error message, someone can help me with this?
Code:
var snd:LoadVars = new LoadVars();
var rcv:LoadVars = new LoadVars();
rcv.onData = function(thedata) { trace("Data Received: " + thedata); }
snd.jsonrpc = '{"jsonrpc": "2.0", "method": "JSONRPC.Introspect", "id": "1"}'
snd.sendAndLoad("http://xbmc.ip.address/jsonrpc", rcv, "POST");
Code:
var snd:LoadVars = new LoadVars();
var rcv:LoadVars = new LoadVars();
rcv.onData = function(thedata) { trace("Data Received: " + thedata); }
snd.jsonrpc = "2.0";
snd.method = "JSONRPC.Introspect";
snd.id = "1";
snd.sendAndLoad("http://xbmc.ip.address/jsonrpc", rcv, "POST");
I'am not able to use the tcp socket because AS2 needs a null char to terminate the string transmision and xbmc seems not sending a null char at the endo of the json strings.
Sorry for bad English!
Please help.
Thank you.
Bye!