facebook actionscript api
先去下載
http://code.google.com/p/facebook-actionscript-api/
goto http://www.facebook.com/developers/
"Set Up New App"
get AppID
參考FlashWebExample
in html
<script src="http://connect.facebook.net/zh_TW/all.js" type="text/javascript">
</script>
<div id="fb-root">
</div>
in flash(using FacebookGraphAPI.swc)
// 初始化 Facebook library
Facebook.init(APP_ID, onInit);
// 登入並取得權限
// var opts:Object = { perms: "publish_stream, user_photos" };
// GraphAPI_Web_1_7.swc 之後 new oAuth2.0
var opts:Object = { scope: "publish_stream, user_photos" };
Facebook.login(onLogin, opts);
// 登出
Facebook.logout(onLogout);
// use GET or POST to send data
Facebook.api(細節參考http://developers.facebook.com/docs/reference/api/)
Facebook.api(methodInput.text, onCallApi, params, requestType);
// using GET
// 取得好友名單
Facebook.api("/me/friends", onCallApi);
// 取得likes list
Facebook.api("/me/likes", onCallApi);
// 取得照片
Facebook.api("/me/photos", onCallApi);
// 取得相簿
Facebook.api("/me/albums", onCallApi);
// publishing use POST
// wall post
Facebook.api("/me/feed", onCallApi, {message:"post message!!"}, requestType);
// Feed dialogs(page/iframe/popup)
// method: stream.publish, feed...
data.link = "http://developers.facebook.com/docs/reference/dialogs/";
data.picture="http://fbrell.com/f8.jpg"
data.name = "這是妳的大名";
data.caption = "這是標題";
data.description = "這是敘述";
// 預設不能帶訊息
//data.message = "這是你想打的訊息";
Facebook.ui(method, data, onUICallback, "popup");
// OAuth Dialog(取得額外權限)
data.perms = "email, read_friendlists, read_mailbox";
Facebook.ui("permissions.request", data, onUICallback, "popup");
沒有留言:
張貼留言