gSkinner - Home

Adobe Releases AS3 Facebook API

Posted on March 31, 2009 by Grant Skinner

Adobe just released the “ActionScript 3.0 Client Library for Facebook Platform API”, which is a wordy name for a pretty straightforward AS3 Facebook API we’ve been working on for the past few weeks.

The library is an updated version of a library originally developed by Jason Crist. We’ve been working with Adobe, Facebook, and Jason to extend it to support all of the Facebook APIs (Canvas, Connect, and Desktop), and to clean up some of the code. That’s not to imply that Jason’s original work wasn’t great, there’s just a limit to how much you can do for free as one guy on an open source project.

The end result is an open source AS3 API that mirrors the documented Facebook API almost exactly. We’ve also added a few helper methods, and some samples to make it easier to get started.

You can get more info here, or grab the library from google code here.

Follow @gskinner on Twitter for more news and views on interactive media.
31 Comments

I am having problems with the webcam example. I didn't change any of the file and I am getting this everytime I run it:

TypeError: Error #1009: Cannot access a property or method of a null object

reference.

at WebCamUploader/WebCamUploader::sendUserToAllow()[C:\DropBox\My

Dropbox\Jeff\APIs\facebook_flash_api\facebook_library_v3.0_source\facebook_source\

Any ideas??

Posted by: Jeff on Mar 31, 2009 12:44pm URL: http://twitter.com/jfall

It seems to be failing here for me:

protected function sendUserToAllow(p_event:MouseEvent):void {

fb.login(true);

}

And yes, I did enter my API Key and Secret Key... :)

Posted by: Jeff on Mar 31, 2009 12:48pm URL: http://twitter.com/jfall

Great news for flash developers who want to leverage the engagement of the facebook platform. At sprout we are doing some cool campaigns and were a part of the AS 3.0 library facebook beta. Already have a working app. check it out here sproutinc.com/socialmedia

Posted by: Joey Mucha on Mar 31, 2009 1:21pm URL: http://sproutinc.com

Could someone recommend any tutorials using the AS3 Facebook Platform API with the Flash IDE? Seems all the available examples are Flex based. Thanks in advance...

Posted by: PR Johnny on Mar 31, 2009 7:20pm

a lot of the demos I have tried won't work

Posted by: Jeff on Apr 1, 2009 9:29am URL: http://twitter.com/jfall

This is the webcam app:

http://apps.facebook.com/webcam_uploader/

It is still throwing that same error. Any ideas?

Posted by: Jeff on Apr 1, 2009 3:01pm URL: http://twitter.com/jfall

Jeff & all Facebook API users. I have just posted updated demo source for all 3 demos to the Google code svn. You can browse the latest source here: http://code.google.com/p/facebook-actionscript-api/source/browse/#svn/trunk/examples.

Posted by: Wes on Apr 1, 2009 5:45pm URL: http://www.gskinner.com/

How do I start a session in an iframe so i dont have to do the login in an external window?

Thx!

Posted by: Juan on Apr 2, 2009 4:45pm URL: http://iamgoose.com

"How do I start a session in an iframe so i dont have to do the login in an external window?

Thx!"

I'd like to know how to do this too. ;-)

Thanks from spain!

Posted by: Roberto Corrales on Apr 8, 2009 4:45am URL: http://www.iluyroberto.com

Just took a quick look at the web cam, where you pass the session_key as a var into the swf.

and establich the connection.

Ill try it out tonight.

Thanks

Posted by: Juan on Apr 8, 2009 8:37am URL: http://iamgoose.com

Is there a cut down version suited to ports. I emailed my question in more detail to your 'info' address.

Posted by: Justin Mills on Apr 12, 2009 6:54am

Hello Grant,

Can you tell the guy that made the ConnectJSdemo to fix it? (Or better, you fix it :P)

It seems that it's not working.

Please have a look at this thread:

http://groups.google.com/group/facebook-actionscript-api/browse_thread/thread/f6ef61562e004485

Thanks in advance

Posted by: Panico on Apr 13, 2009 3:54pm

I would really like to know how the Ben and Jerry's approach works. The only example I've gotten to work forces the app to open a separate browser window, make the user login and close this window, and then click on a button in the app to trigger fb validation - after login is supposedly complete. This is very clunky compared to how it's done in the Ben and Jerry's example.

Posted by: Andy Roberts on May 7, 2009 8:48am

The API itself is very well structured and really easy to get into.

I do however think it's lacking a lot of info on how to effectively integrate it with Facebook Connect. I count myself as a fairly weathered actionscripter and it took me an unecessary amount of time to get it working seamlessly with the 'opaque' facebook connect javascript.

I think the whole package would benefit from a few actual hands on examples. The ones on the adobe page that had one of yours just didn't really cut it when you were looking for a seamless application.

Either way, in the end everything works perfectly and my comment is more of a 'it could save time for a lot of people' than a complaint ;)

/sekasi

Posted by: Erik Hallander on May 12, 2009 7:35pm URL: http://www.erikhallander.com/

Is anyone aware of any examples of using PublishUserAction, etc. (such as creating and working with Templates)? I've searched in vain for any AS-related discussions on the subject.

Great library, by the way!

--ChrisH

Posted by: Chris H on May 15, 2009 8:29pm

sekasi,

You say "I count myself as a fairly weathered actionscripter and it took me an unecessary amount of time to get it working seamlessly with the 'opaque' facebook connect javascript.", to help others who face the same issues, why not offer your code as an example of how to use connect.

Neil

Posted by: Neil on May 28, 2009 7:43am

Grant,

I create AS3 Flash Apps in Flash Builder. From my tests it seems that this Library only works if you are using the Flex framework. Can you confirm this so I can stop running in circles?

Dan W

Posted by: Daniel Wilday on Jun 11, 2009 12:38pm

hi,guys,

im a very recent flash devloper, portuguese living in London, and im Despered, i can't understand faceBook API and get it to work , maybe because im really tired, well may be.

I just need to create something that in my point of view should be very simple, that is a share button in flash AS2 that when released share a title and a text to faceBook. SORRY to ASK this, you are probably very busy, but could you please help? something very simple like:

var TITLE:String;

var TEXT:String;

Share. onRelease = function () {

input_title = TITLE;

input_text = TITLE;

getURL ("http://www.facebook.com/share.php?u=www.mywebsite.com", "_blank", "post");

}

i dont want it to get the title from my index.html.

IN ADVANCE THANK YOU VERY VERY MUCH.

i always will be able to you in case that you need me, what i truly doubt.

Jose.

Posted by: Jose santos on Nov 14, 2009 11:55pm

If you see a blank page and its not working. One of the reason could also be that -

your Facebook App is not configured correctly; the ‘Connect URL’ wasn’t right.

Go through the FB Connect tutorials on the FB wiki. Take notes of the FB App settings, esp the ‘Connect’ tab. Your 'Connect URL' needs to point to the directory where your .swf file is located on the server.

Posted by: Suma Gowda on Dec 6, 2009 12:44pm

Hi,

I just need a couple of info you may provide:

I have a site completly built with Flash, I’d like to create a section in my site where any user can see (by providing facebook username&pwd) all his facebook data (including photos, events, posts, etc…)

Do you think this is possible?

(I'm a very good flash developer but I know very little about facebook...)

Posted by: Alarik on Dec 7, 2009 11:37am

I think Adobe should think twice before allowing you to develop the api because your example source codes don't work. If you are paid to develop the api, then you must provide better documentation and better source codes. can't believe I spent the whole day and can't make your examples work

Posted by: brooklyn on Mar 1, 2010 2:25pm

Firefox version 3.6 won't make flash facebook apps work. I updated my Firefox and since then my apps are not working. I tested the same apps on Firefox version 3.5.8 and things work

Sincerely,

Posted by: ny on Mar 2, 2010 12:10pm

@ny amen to you brother/sister. I just spent 3 hrs trying to connect from a local SWF export.

Firefox 3.6 (MacOS 10.5.8) did open up a window, but never actually navigated to the Facebook login page, and hence would not authenticate me.

Changed the default browser to Safari and that works. Thanks for your post I was going nuts.

Posted by: franz on Mar 12, 2010 1:08pm

Hi, Gskinner

I apologize about what I wrote above. The problem was not your source code, but ff3.6; Your example code work on all browsers but ff3.6;

Sincerely,

Posted by: brooklyn on Mar 21, 2010 9:27am

When I am intending to record a video on facebook with my webcam I continuously receiving a report saying error fail to connect to the server. can this problem rectified

Posted by: Julius on Apr 21, 2010 9:52am URL: http://www.zim.gov.zw

Webcam and FB. Authori.

The FB login.php has changed Apr.2010 to the Graph API. so the Link in the Web: must be any from

// navigateToURL(new URLRequest("http://www.facebook.com/login.php?api_key="+API_KEY));

.e.g. the webcamUploader.as

changed into like:

// navigateToURL(new URLRequest("https://graph.facebook.com/oauth/authorize?client_id=XXX&redirect_uri=http://apps.facebook.com/YourCallbackfolder/scope=user_photos,user_videos,publish_stream,email,user_groups?api_key=XXX"));

}

than the webcam app is initializing the "allow". BUT.the webcam is stilll not showing the webcamimage.

anyone any ideas.

i would appreciating to connect me via facebook:

http://www.facebook.com/profile.php?id=100001200157853&

if you have a solution or not. in this case we should communicate.

and if anyone has a working webcam app. pls let me know.

Kind Regards

Maximilian /euka lyptus/

Posted by: Maximilian on Jun 9, 2010 8:02am URL: http://apps.facebook.com/myeukaapp/

Hi, i've a question about integrating the new like button in as3, this is possible?

Posted by: William Albert on Jul 2, 2010 1:54pm URL: http://www.williamalbert.com.br/

I can't find any documentation on how to "Like" a page in AS3. Has anyone found a solution?

Posted by: Bert on Jul 27, 2010 4:31pm

Hi,

I'd like to know if you have some sample code to tag a photo before using the uploadPhoto method. We're using flex 4 and the Facebook Flex 3.4 API.

Heres what we have do far:

public function set setImage(_image:BitmapData):void

{

var _enc:JPEGEncoder= new JPEGEncoder( 80 );

var _snapshotBA:ByteArray = _enc.encode( _image );

m_image=_snapshotBA;

}

private function uploadImage( _event:Event ):void

{

//Creates the photo and attaches the image to it

var _uploadPhoto:UploadPhoto = new UploadPhoto(m_image);

//Uploads the Photo

var _uploadPhotoPost:UploadPhoto = m_fbook.post(_uploadPhoto) as UploadPhoto;

//Creates an event listener on the Uploading process, that fires once the photo is uploaded successfully.

_uploadPhotoPost.addEventListener(FacebookEvent.COMPLETE, onUploadPhotoComplete,false,0,true);

}

Posted by: Matthew on Sep 22, 2010 7:54am

I am using the api with Air 2.0 and 'Air html'. Login, permission and upload works fine. But I need to log out the user. I tried auth.ExpireSession and auth.RevokeAuthorization but the user is still logged. I even deleted the cookies. But no success.

Did anyone has any idea how to logout the user?

Posted by: dirk on Sep 24, 2010 7:31am

Is the face book like button possible in flash? cant find documentation.

Posted by: sammy on Sep 26, 2010 8:31pm

Leave a Reply

Your email is never published nor shared.




You may use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">