Katax Emperore
Katax Emperore

Reputation: 465

Connect to facebook from Flash

I want to click a button in my flash application, log in to facebook, leave a comment on wall and sign out. I try to figure it out but it seems complicated. Does anyone have an example or any sample code for this easy functionality?

Upvotes: 8

Views: 4664

Answers (3)

Michiel Standaert
Michiel Standaert

Reputation: 4176

As said in previous answers, you can just use the graph api to connect to facebook. Below is a sample of how to start up your connection with facebook and how to get your access_token (It is used here to post to your wall).

public function FBConnect():void
{   
    //Set applicationid
    _applicationID = "YourID";

    //Set permissions to ask for
    _extendedPermissions = {perms:"read_stream, publish_stream, user_about_me, read_friendlists, user_photos"};

    //Initialize facebook
    Facebook.init(_applicationID);
}

public function post(message:String):void
{
    var _params:Object = new Object();

    _params.access_token = Facebook.getSession().accessToken;
    _params.message = message;

    Facebook.api("/" + _user + "/feed", messagePosted, _params, "POST");
}

This should do the trick :)

Upvotes: 1

jpea
jpea

Reputation: 3079

BigSpaceship released a bunch of classes, one of them dealing with Actionscript and connecting to Facebook. Take a gander at their overview page http://www.bigspaceship.com/blog/labs/bss-classes-flash-and-the-fb-graph/ and see if it's something that works for your idea (it seems like it would).

Upvotes: 1

Lelouch Lamperouge
Lelouch Lamperouge

Reputation: 8421

It's good that you have mentioned actionscript3. This is the AS3 SDK for Facebook
On a side note, you might find this article quite useful

Upvotes: 1

Related Questions