2011年9月30日 星期五

google plus api note


1. 準備
先去 google console
開啟 Google+ api service (Courtesy limit: 1,000 queries/day)
再來去 API Access create client ID and simple API Access
勾選 Application type and Redirect URI 填一填
Redirect URI:Google should redirect the browser after the user allows (or denies) the authorization request(簡單講就是授權完要導去的頁面)

2. API 流程
OAuth2->user 登入/同意取得權限->導回 redirect_url 並取得 access_token ->API Call

2011年9月26日 星期一

event hijacking - flash gaia framework

gaia event hijacking 可是相當博大精深的呀~~
首先要知道有哪些 gaia flow events 可用
beforeGoto
afterGoto
beforeTransitionOut
afterTransitionOut
beforePreload
afterPreload
beforeTransitionIn
afterTransitionIn
afterComplete(no hijacking)

假設要在 transitionIn 之前做一些事,
先宣告
private var releaseGaia:Function;
// in constructor
releaseGaia = Gaia.api.beforeTransitionIn(onBeforeTransitionIn,true);

private function onBeforeTransitionIn(event:GaiaEvent):void {
  // do something...
  releaseGaia();
}

另外在 Navigation 裡常用的手法,
// in init
Gaia.api.afterGoto(setPageId, false, false);

private function setPageId(e:GaiaEvent):void {
  trace(e.validBranch);
}
用來做 breadcrumb  還蠻方便的。

[ref]
http://www.gaiaflashframework.com/wiki/index.php?title=Events_and_Hijacking

2011年9月23日 星期五

facebook actionscript api (照片+相簿) - part3

方法一
facebook 上傳照片 + 開相簿:
自動開相簿 + post wall,不想 po 牆請設 no_story:'1'
var params:Object = {image:bitmap, message:'my message', fileName:'myfilename'};
Facebook.api("me/photos", onSaveToPhotoAlbumComplete, params);