To integrate Facebook with a flash pro project you will have to download a couple of libraries: through the google.code source (google: as3 facebook library)
You will mostly need the Desktop and Web versions.
The Desktop version allows you to debug some call locally (not all)
The Web version is used when it's hosted (and thus the final version)
Here is some start up code:
ActionScript Code:
// Import Facebook Library
import com.facebook.graph.Facebook;
// Create some vars
var APP_ID:String = "your_app_id_here";
var loggedin:Boolean = false;
// init function
function init():void {
Facebook.init(APP_ID, fbInit);
}
function fbInit(response:Object, fail:Object):void {
if (response) { // if already logged in
loggedin = true;
//do your stuff here
trace(response); //Trace the response, you will see facebook returns a JSON
// You can look at this JSON to see things like response.name (i.e users name)
} else { // if not logged in
loggedin = false;
loginButton.addEventListener(MouseEvent.CLICK, loginHandler);
}
}
function loginHandler():void {
if(!loggedin) { // if not true
var opts:Object = {scope:"publish_stream"};
Facebook.login(onLogin, opts);
} else {
Facebook.logout(onLogout);
}
function onLogin(result:Object, fail:Object):void {
if (result) { //successfully logged in
trace("Logged In");
} else {
trace("Login Failed");
}
}
function onLogout(success:Boolean):void {
trace("Logged Out");
}
I hope this helps!