The ExternalInterface is not available in this container

2,127 views
Skip to first unread message

Musa YUVACI

unread,
Dec 16, 2011, 11:04:23 AM12/16/11
to facebook-act...@googlegroups.com
Hi,

I am new at AS and flash, i just created a flash actionscript project with flash builder and 
added the  facebook graph api 1.8.1 (GraphAPI_Web_1.8.1.swc). And i wrote that code 
which is below and i am getting this error.Do you know what is the problem.Thanks for your help.


//Error message-----------------------------

 Error #2067: The ExternalInterface is not available in this container. ExternalInterface requires Internet Explorer ActiveX, Firefox, Mozilla 1.7.5 and greater, or other browsers that support NPRuntime.
at Error$/throwError()
at flash.external::ExternalInterface$/addCallback()
at com.facebook.graph::Facebook/init()[C:\Users\facebookGraphApi\api\com\facebook\graph\Facebook.as:630]
at com.facebook.graph::Facebook$/init()[C:\Users\facebookGraphApi\api\com\facebook\graph\Facebook.as:166]
at FacebookSample1()[C:\Users\Musa YUVACI\Adobe Flash Builder 4.5\FacebookSample1\src\FacebookSample1.as:12]



//Code----------------------------------

public class FacebookSample1 extends Sprite {
public function FacebookSample1() {
Facebook.init("FacebookAppID-For Sample Code-",loginHandler);
}

private function loginHandler(success:Object, fail:Object):void {
if(success != null) {

trace("something")
} else {
}
}
}

--
Musa YUVACI
Yazılım Geliştirme Uzmanı / Bilgisayar Mühendisi
Software Specialist / Computer Engineer

omoymenya

unread,
Dec 28, 2011, 2:44:20 PM12/28/11
to facebook-actionscript-api
This appears to be the same problem I post a few weeks ago. The graph
API for web applications uses Javascript as an intermediary between
Flash and Facebook. It does this by using the ExternalInterface
internally to talk to Javascript. If you try to run your code in
debug mode inside Flash Builder or Flash CS5, you will get this error,
because those execution "containers" do not have an HTML wrapper to
talk to via the ExternalInterface. You will have to do all your
testing in a web browser.

One thing you can do is put all your calls to the Facebook API inside
an if statement that checks whether the ExternalInterface is available
or not in the current player. For example:

if (ExternalInterface.available)
{
Facebook.init ("FacebookAppID-For Sample Code-",loginHandler);
}

That way the rest of your code will still run in the debugger, you
just won't be able to test the Facebook portion outside of the web
player.

John Morton

unread,
Dec 30, 2011, 3:27:39 PM12/30/11
to facebook-actionscript-api
Omoymenya is absolutely right about the need of being in a web browser
(on a web server) to get External Interface to execute.

The trouble you'll immediately run into is that when a SWF is on a
webserver, you don't have a way to trace out your debugging code like
you are used to in the Flash development environment. There is a great
solution for that though. Check out http://demonsterdebugger.com/. You
can include it's class and call trace commands from your SWF running
on your server. It's also free. It's an extremely valuable tool.

Good luck,

John

Musa YUVACI

unread,
Jan 2, 2012, 3:45:10 AM1/2/12
to facebook-act...@googlegroups.com
Thank you so much. You are right. I solved the problem.I run the application on the web browser.


2011/12/30 John Morton <john....@gmail.com>
--
You received this message because you are subscribed to the Google Groups "facebook-actionscript-api" group.
To post to this group, send email to facebook-act...@googlegroups.com.
To unsubscribe from this group, send email to facebook-actionscr...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/facebook-actionscript-api?hl=en.

Reply all
Reply to author
Forward
0 new messages