顯示具有 social 標籤的文章。 顯示所有文章
顯示具有 social 標籤的文章。 顯示所有文章

Facebook Graph API Login, PostData

2011年3月12日 星期六 by Hu, Ching-Hsiang

facebook init

Facebook.init('App ID', initLogin);
function initLogin(response:Object, fail:Object):void {//facebook init

}


facebook login

Facebook.login(handleLogin,{perms:"user_birthday,read_stream,publish_stream,user_photos"});
function handleLogin(response:Object, fail:Object):void {//facebook login
if(response!=null){
Facebook.api('/me', onMyInfoLoaded);
}
}

load facebook info and post data

function onMyInfoLoaded(response:Object,fail:Object):void {//facebook info success
if(response!=null){
var params:Object = {
source: 'http://xxx.jpg',
picture: 'http://xxx.jpg',
message: 'text',
link: 'http://adidas-oba2011-2.youthwant.com.tw',
name: 'Adidas is all in',
caption: '內容',
description: '內容'
};
Facebook.postData('/me/feed', requestHandler, params);
}
}
function requestHandler(result:Object, fail:Object):void{
if (result != null){
if (result.error_msg != null){
//error
}else{
//success
}
}
if (fail != null){
//error
}
}

Social Website URL Share

2011年3月10日 星期四 by Hu, Ching-Hsiang

twitter:
http://twitter.com/?status=xxx http://xxx

plurk:
link: http://plurk.com/?status=www.google.com(xxx)
image: http://plurk.com/?status=http://xxx.jpg

facebook:
http://www.facebook.com/share.php?u=http://xxx

Filed under , having 0 意見