ActionScript 3 Facebook更新用户状态

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ActionScript 3 Facebook更新用户状态相关的知识,希望对你有一定的参考价值。

//note that the current class aka this extends FacebookSessionUtil
//initial call checks to see if user has permission to update status
private function postToStatus():void {		
	var call:FacebookCall = facebook.post(new HasAppPermission(ExtendedPermissionValues.STATUS_UPDATE,userId)); 
		call.addEventListener(FacebookEvent.COMPLETE, onStatPermission); 
	}
//if success update -> update status else -> grant permissions (opens a new window in browser)
private function onStatPermission(e:FacebookEvent):void {
        if (e.success && (e.data as BooleanResultData).value) {
	    publishStat();
	}else {	
            this.facebook.grantExtendedPermission(ExtendedPermissionValues.STATUS_UPDATE);
	}
        e.currentTarget.removeEventListener(FacebookEvent.COMPLETE, arguments.callee);
}
//sets the status to a string defined by the user//
private function publishStat():void {			
	 var statcall:FacebookCall = this.facebook.post(new SetStatus(/*insert a string*/));
         statcall.addEventListener(FacebookEvent.COMPLETE, onStatPublish); 
	}

//let the user know it has been published
private function onStatPublish(e:FacebookEvent):void {
        
	 if (e.success) {
		//alert user status has been published
					
	 }else {
	    trace(e.error.rawResult);
	 }
         e.currentTarget.removeEventListener(FacebookEvent.COMPLETE, arguments.callee);
}

以上是关于ActionScript 3 Facebook更新用户状态的主要内容,如果未能解决你的问题,请参考以下文章