2011-01-08 31 views
0

我的項目的目標是如何驗證通過Flash使用我的Flash應用程序的用戶。 我用Flex按照本教程將它sucees它 http://www.adobe.com/devnet/facebook/articles/video_facebook_quick_start.htmlas3 flash臉譜:任何樣品avaible?

但我不能用閃光燈做! 當我下載http://code.google.com/p/facebook-actionscript-api/downloads/list 哪個swc shoudl我使用:mobile/desktop/web?

然後我試圖與GraphAPI Examples_1_5.zip 並得到 API錯誤代碼:191 API錯誤描述:指定的URL不會被應用 錯誤消息所屬:REDIRECT_URI不屬於應用程序。

任何樣品來驗證用戶在閃存(不flex)avaible?

問候

回答

2

我有同樣的問題,我使用源文件結束(這已經非常的教育,太),你可以從谷歌代碼下載: http://code.google.com/p/facebook-actionscript-api/downloads/detail?name=GraphAPI%20Source_1_5.zip&can=2&q=

的例子大多用於製作Flex或AIR,但一旦你掌握了基礎知識,它就非常簡單。這裏有一個例子:

//--- This line should be at the constructor of your main class, so you can tell from the beginning if the user is already logged in facebook and should not be prompted to login again 
Facebook.init('your-app-id', handleLogin); 
//--- This function is called both as the callback of the init method and the login method 
protected function handleLogin($success:Object, $fail:Object):void { 
    if ($success) { 
     //---- your code to the logged in user 
    } 
    else{ 
      Facebook.getLoginStatus () 
      Facebook.addJSEventListener('auth.sessionChange', detectLogin) 
    } 
} 
private function detectLogin($e:Object):void{ 
     if ($e.status == "connected"){ 
      //---- your code to the logged in user 
      } 
     else{ 
      //---- the user cancelled the request 
      } 
     } 
//-------This function must be called from the login button handler or something like that 
public function connect():void { 
    //--- here you have to ask for the permissions you need (the permissions are kind of self explanatory, for a full list visit [here][2]. I'm putting these two just for example purposes) 
    var permissions:Array = ['publish_stream','user_photos']; 
    //--- this method will call a html popup directly from facebook so the user can write his username and password securely. The first parameter is the callback function and the second is a string of the permissions you ask for. 
    Facebook.login(handleLogin, {perms:permissions.join(',')}); 

     } 

正如你所看到的,你這是一種與「getLoginStatus()」兩個人通話,但我就是不能讓沒有它的工作。我認爲這可能不是最好的解決方法,所以如果任何人有更好的解決方案,我會很感激:)

+0

..你如何導入「Facebook」?我試圖讓它工作,但我有錯誤「1120:訪問未定義的屬性Facebook」。 – 2011-06-14 02:55:52