Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
392 views
in Technique[技术] by (71.8m points)

flash - How to create a share button in AS3

I was wondering if anyone knew a good way of creating an AS3 Facebook share button? I need to be able to customize the title, description and picture. Thanks!

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Look: http://www.facebook.com/facebook-widgets/share.php

http://www.facebook.com/sharer.php?u=<url>&t=<title>

In Flash:

import flash.net.navigateToURL;
import flash.net.URLVariables;
import flash.net.URLRequest;
import flash.net.URLRequestMethod;

share_btn.addEventListener(MouseEvent.CLICK, shareClickHandler);

function shareClickHandler(evt:MouseEvent):void
{
    var varsShare:URLVariables = new URLVariables();
    varsShare.u = 'http://domain.com/pageN.html';
    varsShare.t = 'Title Page';

    var urlFacebookShare:URLRequest = new URLRequest('http://www.facebook.com/sharer.php');
    urlFacebookShare.data = varsShare;
    urlFacebookShare.method = URLRequestMethod.GET;

    navigateToURL(urlFacebookShare, '_blank');
}

In order to use a picture add the following Metatags:

<meta name="title" content="my title" />
<meta name="description" content="my description" />
<link rel="image_src" href="images/thumbnail_image.jpg" />

For more info: https://developers.facebook.com/docs/opengraph/


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...