Twitist Forums
getting CS5 to run facebook API? - Printable Version

+- Twitist Forums (http://twitist.com)
+-- Forum: Facebook forums (/forum-14.html)
+--- Forum: Facebook apps (/forum-22.html)
+--- Thread: getting CS5 to run facebook API? (/thread-164633.html)



getting CS5 to run facebook API? - Bluwind - 06-17-2014 01:04 AM

Hi all, ok me and some friends just got together and paid to upgrade to CS5 Flash so we could go semi professional developing games for Facebook, however we seem to hae hit a stumbling block before even starting.
Everytime we try to import the "FacebookGraphAPIDesktop.swc" into our libary it says unexpected file format.
we tried to find the file in extension manager which it couldnt.
As a side note we are all running new windows 7 systems.


- Kevin Nazki - 06-17-2014 01:12 AM

Hi, the Actionscript SDK quickstart examples on the Adobe website may be of help to you:
http://www.adobe.com/devnet/facebook.html

** Note you cannot run/test Facebook API code on your local machine specially through AS3. You must first place it on a server to test if it works.

Here some i.e code..

// import the class
import com.facebook.graph.Facebook;

// you must first initiate your Facebook class
Facebook.init('Application_ID',FBConnected,{perms:"read_stream,publish_stream"}); // if you are logged into Facebook and the user has not already allowed the application access, it asks the user if the application can read streams and publish to them

var fbSession:Object = new Object();
var myAvatarURL:String = "";

function FBConnected(success:Object,fail:Object)
{
if(success)
{
fbSession = Facebook.getSession(); // gets the current session
// use fbSession.accessToken as your session token
Facebook.api("/me",getMeHandler); // asks for your profile information
}
}

function getMeHandler(result:Object,fail:Object)
{
if(result)
{
trace(result.name); // returns your profile name as string
trace(result.id); // returns your id as string
// check out https://graph.facebook.com/me?access_token... for more information on what result returns

myAvatarURL = Facebook.getImageUrl(result.id); // use this to create a URLRequest to get your avatar
}
}
After doing that try to visit this link for more flash games...
http://bit.ly/eKsNpR