Skip to main content
Known Participant
June 21, 2013
Answered

URGENT - Facebook log-in in Flash game

  • June 21, 2013
  • 1 reply
  • 6314 views

I am having trouble implementing the Flash API in my game... I tried opening one of the examples of the API, I put the latest API source files in the folder and it gives me errors from the source files...

https://code.google.com/p/facebook-actionscript-api/ This is the API I tried.

If anyone knows how to implement Facebook login into a game, please help...

This topic has been closed for replies.
Correct answer kglad

this is an excerpt from a recently published book i wrote (http://www.amazon.com/s/ref=nb_sb_noss?url=search-alias%3Daps&field-keywords=gladstien):

The Adobe Facebook ActionScript API also uses the ExternalInterface class and JavaScript to communicate with Facebook so you still need to use swf embedding code that is compatible with the ExternalInterface class. Adobe uses SWFObject (http://code.google.com/p/swfobject) to embed the swf and injects the JavaScript using xml and ActionScript. You can check the FacebookJSBridge class to see how that is done.

At the time of this writing, the Adobe Facebook ActionScript (version 1.8.1) code uses Mike Chamber's JSON class.  But if you are publishing for Flash Player 11 or better, you must use the native Flash JSON class.

Both JSON classes are similar in that they are named the same and use static functions to convert to and from JSON format. Where Chamber's JSON class uses JSON.decode() and JSON.encode(), the native Flash JSON class uses JSON.parse() and JSON.stringify().

So, if you use Adobe's Facebook ActionScript API and see

1061: Call to a possibly undefined method encode through a reference with static type Class.

errors, you'll need to replace JSON.decode() with JSON.parse and JSON.encode() with JSON.stringify().

To use Adobe's Facebook ActionScript API, navigate to http://code.google.com/p/facebook-actionscript-api and download the latest version of the GraphAPI documentation, examples, source code and/or swc files.

If you are publishing for Flash Player 11 or better, you will need to change all the JSON methods in the non-swc files.  If you use the swc files instead of the source files, you will have less code to change.

In support files/Chapter 11/facebook/fb2 are files that use Adobe's Facebook ActionScript API for the web. The code that uses the API is in FlashWebMain.as.

With only a few changes FlashWebMain.as (the document class of FlashWebExample.fla) is the same as Adobe's example file with the same name. I added details (in cbF, dialogsF and graphF) showing how to use the Facebook.ui and Facebook.api methods.

1 reply

kglad
Community Expert
kgladCommunity ExpertCorrect answer
Community Expert
June 21, 2013

this is an excerpt from a recently published book i wrote (http://www.amazon.com/s/ref=nb_sb_noss?url=search-alias%3Daps&field-keywords=gladstien):

The Adobe Facebook ActionScript API also uses the ExternalInterface class and JavaScript to communicate with Facebook so you still need to use swf embedding code that is compatible with the ExternalInterface class. Adobe uses SWFObject (http://code.google.com/p/swfobject) to embed the swf and injects the JavaScript using xml and ActionScript. You can check the FacebookJSBridge class to see how that is done.

At the time of this writing, the Adobe Facebook ActionScript (version 1.8.1) code uses Mike Chamber's JSON class.  But if you are publishing for Flash Player 11 or better, you must use the native Flash JSON class.

Both JSON classes are similar in that they are named the same and use static functions to convert to and from JSON format. Where Chamber's JSON class uses JSON.decode() and JSON.encode(), the native Flash JSON class uses JSON.parse() and JSON.stringify().

So, if you use Adobe's Facebook ActionScript API and see

1061: Call to a possibly undefined method encode through a reference with static type Class.

errors, you'll need to replace JSON.decode() with JSON.parse and JSON.encode() with JSON.stringify().

To use Adobe's Facebook ActionScript API, navigate to http://code.google.com/p/facebook-actionscript-api and download the latest version of the GraphAPI documentation, examples, source code and/or swc files.

If you are publishing for Flash Player 11 or better, you will need to change all the JSON methods in the non-swc files.  If you use the swc files instead of the source files, you will have less code to change.

In support files/Chapter 11/facebook/fb2 are files that use Adobe's Facebook ActionScript API for the web. The code that uses the API is in FlashWebMain.as.

With only a few changes FlashWebMain.as (the document class of FlashWebExample.fla) is the same as Adobe's example file with the same name. I added details (in cbF, dialogsF and graphF) showing how to use the Facebook.ui and Facebook.api methods.

Known Participant
June 21, 2013

Hey, thank you so much for the answer...

I will try it out first thing tomorrow morning, as it's late now here.
From the answer you've given, I am positive that it will work, thank you a lot ...
Also, your book interesting, I may give it a read ...

Good Luck,

George

kglad
Community Expert
Community Expert
June 21, 2013

sounds good.