PDA

View Full Version : LocalConnection


thobson
11-12-2008, 05:40 AM
I'm developing a facebook application using OL 3.3.3. Facebook say I can make calls to the host browser via a LocalConnection object but their sample code is written in AS2/3. Could anyone give me any pointers for using this within OL? Here is the relevant section of their docs (http://wiki.developers.facebook.com/index.php/Fb:fbjs-bridge):


var connection:LocalConnection = new LocalConnection();
var connectionName:String = _root.fb_local_connection;
function callFBJS(methodName:String, parameters:Array):Void {
if (connectionName) {
connection.send(connectionName, "callFBJS", methodName, parameters);
}
}

callFBJS("document.setLocation", ["http://someurl"]);

I was hoping to do something like:

var connection = new LocalConnection();
var socketName = global.fb_local_connection;
connection.send(socketName, "callFBJS", "document.setLocation", "http://www.google.com");

But this doesn't seem to work (I dont get any errrors - nothing happens)

Thanks

Toby

thobson
11-12-2008, 06:01 AM
There was nothing wrong with my code ... the problem was with the FB wrapper - FB have changed it, but haven't updated their docs :mad:

For anyone who is developing a FB app using OL, here is how to navigate to a new URL

fbml page:

<fb:fbjs-bridge />
<fb:swf swfsrc="laszloapp.swf" ... />

laszlo app:

var connection = new LocalConnection();
var socketName = global.fb_local_connection;
connection.send(socketName, "navigateToURL" "http://someurl");

Toby