Skip to content

netoleal/FacebookUtils

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 

Repository files navigation

Facebook Utils

Lib de classes uteis para criação de aplicativos AS3 que integram com a Facebook API.

Atenção!!

Este projeto usa classes do ASF2 e contém um SWC com tais classes. Porém, para ter certeza que você tem essas classes em sua versão mais atualizada, baixe o repositório do ASF2 em https://github.com/netoleal/ASF2.

Atenção!! #2

Não existe o compromisso de manter sempre essa lib 100% atualizada com a GraphAPI do Facebook. Todos sabemos que eles insistem em mudar a API o tempo inteiro e então vou atualizando conforme for havendo a necessidade ou mudanças forem apontadas por quem estiver usando. Portanto se você encontrou algum bug e/ou alteração na API que não está prevista aqui, fique à vontade para fazer um Pull request com sua atualização ;)

Exemplo básico

package
{
  import com.netoleal.facebook.app.FacebookApplication;
  import com.netoleal.facebook.model.FacebookFriendModel;
  import com.netoleal.facebook.connections.Friends;
  import com.netoleal.facebook.app.Permissions;
  
  public class FacebookApplicationExample
  {
    private var fb:FacebookApplication;
    
    public function FacebookApplicationExample( )
    {
      init( );
    }
    
    public function init( ):void
    {
      fb = new FacebookApplication( "_app_id_here_" );
      fb.init( ).queue( onFacebookInit );
    }
    
    private function onFacebookInit( success:Boolean ):void
    {
      trace( success );
      
      if( !success )
      {
        fb.loginUser(
          Permissions.USER_PHOTOS, 
          Permissions.PUBLISH_STREAM, 
          Permissions.READ_FRIENDLISTS, 
          Permissions.USER_LOCATION, 
          Permissions.USER_LIKES,
          Permissions.USER_RELATINSHIPS,
          Permissions.USER_ABOUT_ME
         ).queue( onLogin );
      }
      else
      {
        onLogin( true );
      }
    }
    
    private function onLogin( success:Boolean ):void
    {
      trace( fb.user );
      fb.user.friends.load( ).queue( onLoadFriends );
    }
    
    private function onLoadFriends( friends:Friends ):void
    {
      trace( friends.items.length );
      
      var firstFriend:FacebookFriendModel = friends.items[ 0 ];
      
      firstFriend.user.load( ).queue( onFriendUserLoad, firstFriend );
    }
    
    private function onFriendUserLoad( friend:FacebookFriendModel, success:Boolean ):void
    {
      trace( friend.user.fullName );
    }
    
    
    public function dispose():void
    {
    }
  }
}

License

Licensed under the MIT License

Copyright (c) 2011 Neto Leal

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

http://www.opensource.org/licenses/mit-license.php

About

Classes uteis para manipulação de apps que integram com Facebook

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published