VideoHive

Facebook api help

1914 posts
  • Has been a member for 3-4 years
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Contributed a Tutorial to a Tuts+ Site
  • Contributed a Blog Post
  • Attended a Community Meetup
  • Gold Mo Grower
  • Envato Staff
  • Site Manager
  • Exclusive Author
  • Bought between 10 and 49 items
  • United States
  • Referred between 1 and 9 users
LanceSnider says

I just went through this tut: http://www.adobe.com/devnet/facebook/articles/deploy_your_first_facebook_app.html about deploying flash facebook apps. I followed it exactly and it didn’t work correctly. I thought it might be me, but I downloaded the sample files and got the same result.

Here’s the link to the app: http://www.facebook.com/apps/application.php?id=314198047446 It shouldn’t let you see it without logging in and saying allow. Instead it lets you go right to it and doesn’t connect. Please see the code below and let me know if you have any suggestions.

Thanks!

package{

    import flash.display.MovieClip;
    import flash.events.MouseEvent;
    import flash.text.TextField;
    //fb classes
    import com.facebook.Facebook;
    import com.facebook.utils.FacebookSessionUtil
    import com.facebook.net.FacebookCall;
    import com.facebook.commands.users.GetInfo;
    import com.facebook.data.users.GetInfoFieldValues;
    import com.facebook.events.FacebookEvent;
    import com.facebook.data.users.FacebookUser;
    import com.facebook.data.users.GetInfoData;

    public class Main extends MovieClip{

        private var fbook:Facebook;
        private var session:FacebookSessionUtil;
        private var user:FacebookUser;

        public function Main(){

            btn1.visible = false;

            session = new FacebookSessionUtil("", "", stage.loaderInfo);
            fbook = session.facebook; 

            session.addEventListener(FacebookEvent.CONNECT, onFbConnect);

            if(loaderInfo.parameters.fb_sig_session_key){
                session.verifySession();
            }else{
                session.login();
                btn1.visible = true;
                btn1.addEventListener(MouseEvent.CLICK, confirmLogin);
            }

        }

        private function confirmLogin(e:MouseEvent):void{

            this.removeChild(btn1);
               session.validateLogin();

        }

        private function onFbConnect(e:FacebookEvent):void{
            if(e.success){

                var fbCall:FacebookCall = fbook.post(new GetInfo([fbook.uid], [GetInfoFieldValues.ALL_VALUES])); 
                fbCall.addEventListener(FacebookEvent.COMPLETE, onGetInfo);
            }else{
                text_txt.text = "error";
            }

        }

        private function onGetInfo(e:FacebookEvent):void{

            user = (e.data as GetInfoData).userCollection.getItemAt(0) as FacebookUser;
            text_txt.text = user.name;

        }

    }

}
2 years ago
LanceSnider is an Envato staff member
217 posts
  • Has been a member for 4-5 years
  • Exclusive Author
  • Sold between 10 000 and 50 000 dollars
  • Bought between 10 and 49 items
  • United States
  • Referred between 50 and 99 users
animike says

check the comments on this link:

http://www.adobe.com/devnet/facebook/articles/build_your_first_facebook_app.html

it is the prerequisite tutorial to the one you did. there are some errors addressed in the comments section.

2 years ago
1914 posts
  • Has been a member for 3-4 years
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Contributed a Tutorial to a Tuts+ Site
  • Contributed a Blog Post
  • Attended a Community Meetup
  • Gold Mo Grower
  • Envato Staff
  • Site Manager
  • Exclusive Author
  • Bought between 10 and 49 items
  • United States
  • Referred between 1 and 9 users
LanceSnider says

Thanks Animike. Turns out this tutorial is outdated.

If anyone knows of a tutorial or example to get me started, I’d really appreciate it.

2 years ago
LanceSnider is an Envato staff member
1914 posts
  • Has been a member for 3-4 years
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Contributed a Tutorial to a Tuts+ Site
  • Contributed a Blog Post
  • Attended a Community Meetup
  • Gold Mo Grower
  • Envato Staff
  • Site Manager
  • Exclusive Author
  • Bought between 10 and 49 items
  • United States
  • Referred between 1 and 9 users
LanceSnider says

Solved! Wow, that took me way longer than I expected. Here’s the blog that kept me from going completely insane: http://www.gibsontang.com/?p=483

2 years ago
LanceSnider is an Envato staff member
by
by
by
by
by