5/05/2011
用flash分享內容到facebook等
http://benlibra.blogspot.com/2010/02/facebookplurktwitter.html
//原文出處
在htm寫入,js/FB_n_plurk.js是自己寫的JS function -------------------------------
<script type="text/javascript" src="js/FB_n_plurk.js"></script><!--臉書鋪浪-->
建構一個內容包含FB跟鋪浪函式JS-----------------------------------------------
function push_to_plurk()
{
var status_str = "www.bausch.com.tw/hd-girlfriend+(如何在昏暗環境中,看得清楚化身犀利正妹、犀利招數全教你)";
window.open("http://www.plurk.com/?status=" + status_str +"&qualifier=shares");
}
function push_to_fb()
{
var fb_image = encodeURIComponent("http://profile.ak.fbcdn.net/hprofile-ak-snc4/371536_1520829698_1497056219_n.jpg");
var link = "http://www.bausch.com.tw/hd-girlfriend";
var title = "超犀利黑暗化妝術,有屌! ";
var summary = "如何在昏暗環境中,看得清楚化身犀利正妹、犀利招數全教你";
var url = "http://www.facebook.com/sharer.php?s=100&p[url]={url}&p[title]={title}&p[summary]={summary}&p[images][0]=" + fb_image;
url = url.replace(/{title}/gi, encodeURIComponent(title));
url = url.replace(/{url}/gi, encodeURIComponent(link));
url = url.replace(/{summary}/gi, encodeURIComponent(summary));
window.open(url,'ewin' ,'scrollbars=yes,resizable=yes,width=600,height=400')
}
//------------------flash呼叫js----------------------
//在flash寫入(這是as2)
FB_btn.onRelease = function() {
getURL("javascript:push_to_fb();", "_self");//使用js臉書function
};
plurk_btn.onRelease = function() {
trace("鋪浪");
getURL("javascript:push_to_plurk();");//使用js撲浪function
};
//在flash寫入(這是as3)
//Facebook Button Setup
Facebook_btn.addEventListener(MouseEvent.CLICK, clickFacebook);
function clickFacebook(e:MouseEvent):void {
ExternalInterface.call("push_to_fb");
}
這是已經寫好的demo,我js分享寫在htm裡面
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment