I want to send a simple json data (in ActionScript 3) from client for executing cloudScript but when I'm using bellow scripts the result is null
var objStr:Object = JSON.stringify( { "score":1, "dist":100 }); //CloudRequest is an instace of class ExecuteCloudScriptRequest //UpdateUserStat is my Cloudscript function name var CReq:CloudRequest=new CloudRequest("UpdateUserStat",objStr)
This is cloud Script
handlers.UpdateUserStat = function (args) { //args. is JSON data we are passing to function from AS3 (Statistics JSON variable) var scoreNum = args.scoreNum; // "scoreNum" is the JSON number field named "scoreNum" in example above var score = args.score; // "score" is the JSON string field named "score" var keyString = score; var userStatJSON = {}; //this is creating empty JSON data object userStatJSON[score] = scoreNum; // make sure we are updating levelname string by a number of score server.UpdateUserStatistics({ // this is server function which will update user statistic using dataToUpdate PlayFabId: currentPlayerId, // currentPlayerID will be there automatically if player is logged UserStatistics: userStatJSON // this is actual JSON data that we will be updating. (<"levelname", "score">) }); var message = "score: " + score + " scoreNum: " + scoreNum; return { messageValue: message }; }