ForticomAPI addEventListener ApiCallbackEvent CALL_BACK function handl

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
ForticomAPI.addEventListener(ApiCallbackEvent.CALL_BACK,
function handleCallbackSuccess(event : ApiCallbackEvent):void
{
if (event.result == "ok") {
request["resig"] = event.data;
_dp.request("stream.publish", { callback : function foo():void {},
params : request, onComplete: function(func : Function, response: XML): void { }
});
if (_notify_tamplate_id != -1)
StatisticsSender.send(StatisticsSenderEnum.NOTIFICATION_STATE, { sns:PID, app:appId, message_id:_notify_tamplate_id, stage:"send", lang:language } );
} else
trace("nothing!");
}
);
var msgArr:Array = String(parameters.text).split("::");
var request : Object = { message: msgArr[0], method:"stream.publish", format:"JSON" };
if (parameters.attachment != undefined) {
var msgCaption:String = (msgArr[1] != undefined)?msgArr[1]:"";
request.attachment = '{"caption":"'+ msgCaption +'", "media":[{"src":"'+ parameters.attachment +'","type":"image"}]}';
}
request = SignUtil.signRequest(request, true);
var confirmationText:String = (msgArr[1] != undefined) ? msgArr[1] : msgArr[0];
ForticomAPI.showConfirmation("stream.publish", confirmationText, request["sig"]);