Select to view content in your preferred language

Social media share buttons

1086
3
Jump to solution
11-16-2012 08:00 AM
MarkLecher
Deactivated User
I wish to put Facebook, Twitter and Pinterest 'share' buttons on a flex based web mapping application that I am building.  Do I need a special widget for that, or can I use code from places like sharethis.com, or addthis.com?

I do not want to do anything other than allow the user to click the button for the social media platform they want, and share/pin/tweet the link to the website on their wall.
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
philippschnetzer
Frequent Contributor
I tried to use sharethis and addthis code straight from their sites but didn't have any luck...not to say it can't be done...I'm just not an expert.  I did, however, manage to get something working, I placed three icons (twitter, facebook, and linkedin) on my map and referenced these functions when clicked...

public function twitter():void    {     navigateToURL(new URLRequest ("http://api.addthis.com/oexchange/0.8/forward/twitter/offer?url=http://www.xxxxxxxxxxx.com"), "_blank");    }        public function facebook():void    {     navigateToURL(new URLRequest ("http://api.addthis.com/oexchange/0.8/forward/facebook/offer?url=http://www.xxxxxxxxxx.com"), "_blank");    }        public function linkedin():void    {     navigateToURL(new URLRequest ("http://api.addthis.com/oexchange/0.8/forward/linkedin/offer?url=http://www.xxxxxxxx.com/"), "_blank");    }


My code for the icon looks like this:

<s:Image  id="myFxImage" source="assets/images/twitter.png"  alpha="0.7" click="twitter()"   mouseOver="onImageMouseOver()" mouseOut="onImageMouseOut()"/>      <s:Image  id="myFxImage2" source="assets/images/facebook.png"  alpha="0.7" click="facebook()"   mouseOver="onImageMouseOver2()" mouseOut="onImageMouseOut2()"/>      <s:Image  id="myFxImage3" source="assets/images/linkedin.png"  alpha="0.7" click="linkedin()"   mouseOver="onImageMouseOver3()" mouseOut="onImageMouseOut3()"/>


Maybe not the perfect way to do it but it posts the link to their walls...

View solution in original post

0 Kudos
3 Replies
philippschnetzer
Frequent Contributor
I tried to use sharethis and addthis code straight from their sites but didn't have any luck...not to say it can't be done...I'm just not an expert.  I did, however, manage to get something working, I placed three icons (twitter, facebook, and linkedin) on my map and referenced these functions when clicked...

public function twitter():void    {     navigateToURL(new URLRequest ("http://api.addthis.com/oexchange/0.8/forward/twitter/offer?url=http://www.xxxxxxxxxxx.com"), "_blank");    }        public function facebook():void    {     navigateToURL(new URLRequest ("http://api.addthis.com/oexchange/0.8/forward/facebook/offer?url=http://www.xxxxxxxxxx.com"), "_blank");    }        public function linkedin():void    {     navigateToURL(new URLRequest ("http://api.addthis.com/oexchange/0.8/forward/linkedin/offer?url=http://www.xxxxxxxx.com/"), "_blank");    }


My code for the icon looks like this:

<s:Image  id="myFxImage" source="assets/images/twitter.png"  alpha="0.7" click="twitter()"   mouseOver="onImageMouseOver()" mouseOut="onImageMouseOut()"/>      <s:Image  id="myFxImage2" source="assets/images/facebook.png"  alpha="0.7" click="facebook()"   mouseOver="onImageMouseOver2()" mouseOut="onImageMouseOut2()"/>      <s:Image  id="myFxImage3" source="assets/images/linkedin.png"  alpha="0.7" click="linkedin()"   mouseOver="onImageMouseOver3()" mouseOut="onImageMouseOut3()"/>


Maybe not the perfect way to do it but it posts the link to their walls...
0 Kudos
MarkLecher
Deactivated User
Thank you so much.  This is great.
0 Kudos
philippschnetzer
Frequent Contributor
In case anyone is interested....

found a much easier and better way of doing this...just use Robert's LinkWidget and create an entry for each site you want to share to, include a custom icon as well, and just set the url in the LinkWidget.xml's to these:

TWITTER http://api.addthis.com/oexchange/0.8/forward/twitter/offer?url=http://www.yourdomain.com/

FACEBOOK http://api.addthis.com/oexchange/0.8/forward/facebook/offer?url=http://www.yourdomain.com/

LINKEDIN http://api.addthis.com/oexchange/0.8/forward/linkedin/offer?url=http://www.yourdomain.com/
0 Kudos