Solution for non ISO-8859-1 languages
This short tutorial is just a sub page of the "Accessing a service from Flash 8". It might be interesting for those who is trying to pass
Accessing exposed services from Flash8 Professional is easy, but some basic setup is required. Below the setup is sample code scraped right out of a thread in the Services group with one minor modification: I added a bit more to getData_Result to dump the retrieved node.title and node.body as well as peppered with comments for the less-adventurous.
// Picking up a Drupal node with flash remoting
// Drupal must be set up with Services module enabled
import mx.remoting.Service;
import mx.remoting.PendingCall;
import mx.rpc.RelayResponder;
import mx.rpc.FaultEvent;
import mx.rpc.ResultEvent;
import mx.remoting.debug.NetDebug;
// expose debugging info to clientside "NetConnection debugger" utility
mx.remoting.debug.NetDebug.initialize();
// create, position, and set params on three dynamic text fields: status, node-title, and node-body
var tf:TextField = this.createTextField("status", 10, 0, 0, 200, 200);
var ntitle:TextField = this.createTextField("nodetitle", 11, 0, 50, 200, 200);
var nbody:TextField = this.createTextField("nodebody", 12, 0, 100, 200, 400);
ntitle.html = true;
ntitle.multiline = true;
nbody.html = true;
nbody.multiline = true;
nbody.wordWrap = true;
// establish connection with remote service gateway in Drupal and specify service
// - /services/amfphp is AMFPHP in Services gateway
// - node is one of the two default, exposed services in Services module. The other is view.
var node:Service = new Service("http://sitedomain/services/amfphp", new Log(), "node", null, null);
// call service method
// - load is one of three methods on the default node service
// - pass in which node to load (hard coded "1" here for node 1)
// - optional additonal param to node.load is what fields to return (like in a view?).
// -- array of field names: node.load(1, ['title', 'body']);
// -- default is to send the entire node. This example does that.
var pc:PendingCall = node.load(1);
// set up response handler functions
pc.responder = new RelayResponder(this, "getData_Result", "getData_Fault");
// set default status text
tf.text = "no response from server yet.";
// success result handler
function getData_Result( re:ResultEvent ):Void {
// re is the object containing the response
// two properties you can count on being populated for any node are re.result.title and re.result.body
tf.text = "response:";
ntitle.htmlText = "<b>Node Title:</b><br/>" + re.result.title;
nbody.htmlText = "<b>Node Body:</b><br/>" + re.result.body;
}
// failure result handler
function getData_Fault( fe:FaultEvent ):Void {
tf.text = "error";
}
The above sample calls the "load" method on the service "node" with a hard-coded parameter of "1" for "node/1". The node service and its methods (load, save, delete) are exposed by the installation of the Services module. Any other methods you wish to call need to be written a Services hook (see the Services handbook).
In a real setting, you would of course consider managing sessions and logins more restrictively.
This short tutorial is just a sub page of the "Accessing a service from Flash 8". It might be interesting for those who is trying to pass