I had that problem too. The issue is that send requires a Basic Object.
The way I fixed it was:
public function save():void{
var service:HTTPService = new HTTPService();
service.url = "http://127.0.0.1:3000/flex/save_client
<http://127.0.0.1:3000/flex/save_client> ";
service.useProxy = false;
service.resultFormat = "text";
service.method = "POST";
service.addEventListener(ResultEvent.RESULT, onSaveResult);
service.addEventListener(FaultEvent.FAULT, serviceFault);
var o:Object = new Object();
o.id = id;
o.name = name;
service.send(o);
CursorManager.setBusyCursor();
//note you can also do service.showBusyCursor = true or false;
}
________________________________
From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of ronnlixx
Sent: Thursday, April 05, 2007 10:44 AM
To: [email protected]
Subject: [flexcoders] Actionscript based model to HTTPService send call?
Is there a way to cast Client to a simple Object in order to use to in
the call to HTTPService.send()?
i tried the following:
service.send(this); which does not work
service.send(this as Object); which does not work
do I need to manually constuct the generic object?
package com.my.models
{
[Bindable]
public class Client
{
public var id:String;
public var name:String;
public function Client(){}
public function save():void{
var service:HTTPService = new HTTPService();
service.url = "http://127.0.0.1:3000/flex/save_client
<http://127.0.0.1:3000/flex/save_client> ";
service.useProxy = false;
service.resultFormat = "text";
service.method = "POST";
service.addEventListener(ResultEvent.RESULT, onSaveResult);
service.addEventListener(FaultEvent.FAULT, serviceFault);
service.send(this); // does not work
CursorManager.setBusyCursor();
}
}