2011-01-08 34 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