Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 04-26-2012, 06:43 AM   #1
tydygunn
Registered User
 
Join Date: Jun 2011
Posts: 25
Default Facebook integration with Flash Pro, not Flex?

Howdy all,

I want to get one of my pet projects up on facebook, but I've built them in Flash Pro CS5. I've never worked with Flex or Flash Builder (even though I hear they're better for coding), and don't have the money to get a license right now, nor do I really wish to (I'd rather not rebuild my current projects).

So, to get to my question: How do I get my Flash Pro projects on Facebook? I've been over several tutorials on both developers.facebook.com and adobe.com, the ones on FB are largely non-Flash related, and the ones on Adobe's site are all Flex specific.

In Flash Pro, you can't set up an MXML layer on top, at least as far as I'm aware. Is there another way?

Thanks.
tydygunn is offline   Reply With Quote
Old 05-07-2012, 11:05 AM   #2
Shuyinsama
Registered User
 
Join Date: Nov 2009
Posts: 2
Default

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!
Shuyinsama is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 11:59 AM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.