views:

251

answers:

3

So here's the situation: I have a Flash application I'm deploying to facebook as a canvas app. There are various states within this app - different "pages", sort of.

I want to be able to share this app with other users using Facebook's baked-in sharing mechanism. However, I want each state to have its own share button. That way when someone clicks Share on page 3 they are actually sharing page 3, not the root of the whole application.

Does anyone know if Facebook exposes some mechanism by which this could be possible? It would be as simple as passing a string into the iFrame that holds the canvas app, so I could load it in as a FlashVar and work from there.

I'm kind of beating my head against the wall - does this request make sense, and has anyone tackled anything like this before?

Thanks!

A: 

If you use the new Stream.publish APIs you can dynamically generate the link you are sharing (using javascript)

FB.Connect.streamPublish

All you have to do now is setup your flash to call a javascript function which updates which "page" you are on.

Janek
A: 

I am not sure about the facebook mechanism exactly but you should be able to post the url to your app when you 'share' that takes an argument which specifies the page you want. Take a look at this http://livedocs.adobe.com/flex/3/html/help.html?content=deep%5Flinking%5F5.html for an example of reading the url argument. Hope this helps.

dennisjtaylor
Yeah, URL query strings and anchor tags and POST and GET vars can all be passed in as FlashVars which would give me the functionality I need - unfortunately, Facebook forces Flash to run in a sandboxed iFrame and it seems like they don't want you to be able to pass variables in that way. The app doesn't have access to the URL so even an #anchor tag won't work.I'll figure something out. Thanks for the feedback!
Myk
A: 

You can pass data back into the app from JavaScript using FBJSBridge. It's basically the sandboxed version of ExternalInterface. Since facebook changes all you js method names upon parsing the page, it allows you to still call those methods from flash with their original names. Here's a link to the docs:

http://wiki.developers.facebook.com/index.php/Fb:fbjs-bridge

ezekielDFM