Skip to content

Instantly share code, notes, and snippets.

@RhinoLu
Created June 27, 2012 08:27
Show Gist options
  • Save RhinoLu/3002431 to your computer and use it in GitHub Desktop.
Save RhinoLu/3002431 to your computer and use it in GitHub Desktop.
透過 javascript 貼牆,並回傳 flash
public function doShare():void
{
if (ExternalInterface.available)
{
ExternalInterface.addCallback("onShareSingleComplete", onShareSingleComplete);
ExternalInterface.call("myShare", "onShareSingleComplete");
}
}
public function onShareSingleComplete(result:String):void
{
if (result == "false")
{
trace("post 失敗 或 不分享");
}
else
{
trace("post 成功");
}
}
function myShare(_callBack)
{
var feed_obj = {};
feed_obj.to = "";
feed_obj.method = "feed";
feed_obj.name = "標題";
feed_obj.link = "http://www.xxx.com.tw/";
feed_obj.picture = "http://www.xxx.com.tw/images/fb.jpg";
feed_obj.description = "內文";
feed_obj.display = "popup";
FB.ui(feed_obj, function(response)
{
if (response && response.post_id)
{
document["flashcontent"][_callBack](response.post_id);
}
else
{
document["flashcontent"][_callBack]("false");
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment