<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Ian Serlin &#187; Social networking</title>
	<atom:link href="http://ianserlin.com/index.php/category/social-networking/feed/" rel="self" type="application/rss+xml" />
	<link>http://ianserlin.com</link>
	<description>identifying pain points and creating chaos since 1984</description>
	<lastBuildDate>Fri, 08 Jan 2010 00:18:42 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Adding Facebook / Twitter / MySpace / Digg / Reddit / Bitly share functionality to your ActionScript 3/Flex application</title>
		<link>http://ianserlin.com/index.php/2009/12/18/adding-facebook-twitter-myspace-digg-reddit-bitly-share-functionality-to-your-actionscript-3flex-application/</link>
		<comments>http://ianserlin.com/index.php/2009/12/18/adding-facebook-twitter-myspace-digg-reddit-bitly-share-functionality-to-your-actionscript-3flex-application/#comments</comments>
		<pubDate>Fri, 18 Dec 2009 10:23:11 +0000</pubDate>
		<dc:creator>Ian Serlin</dc:creator>
				<category><![CDATA[Actionscript 3]]></category>
		<category><![CDATA[Adobe Flex]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Social networking]]></category>
		<category><![CDATA[bitly]]></category>
		<category><![CDATA[digg]]></category>
		<category><![CDATA[facebook]]></category>
		<category><![CDATA[myspace]]></category>
		<category><![CDATA[reddit]]></category>
		<category><![CDATA[share]]></category>
		<category><![CDATA[twitter]]></category>

		<guid isPermaLink="false">http://ianserlin.com/?p=94</guid>
		<description><![CDATA[I&#8217;m not sure that I need to write anything about the importance of including social sharing tools in any project destined for more than a few people to use, but in case you think I do, here goes:  
If you make something that peoples reputations could benefit from being associated with and that thing [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m not sure that I need to write anything about the importance of including social sharing tools in any project destined for more than a few people to use, but in case you think I do, here goes:  </p>
<p>If you make something that peoples reputations could benefit from being associated with and that thing is easy to share, people will share it&#8230; and more people will use it.
</p>
<h2>Problem</h2>
<p>There are many different social sharing APIs and you&#8217;d like to integrate some of these into your Flash/Flex project. Unfortunately, wrangling everything together isn&#8217;t as easy as it is in Javascript as long as tools like <a href="http://sharethis.com" target="_blank">ShareThis</a> and <a href="http://addthis.com" target="_blank">AddThis</a> continue to treat Flash apps as second class citizens.</p>
<h2>Solution</h2>
<p>The Share class let&#8217;s you initialize the title, description and custom tweet text associated with your content and then easily launch the share pages for Twitter, Facebook, MySpace, Digg and Reddit pre-populated with your specified text. As an added bonus, when you initialize the Share class it will contact <a href="http://bit.ly" target="_blank" title="Shorten, Share and track your links">bitly</a> to create a bitly url you can use for the current page your swf is embedded on.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
</pre></td><td class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #9900cc; font-weight: bold;">package</span> <span style="color: #000000;">&#123;</span>
&nbsp;
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.errors</span>.<span style="color: #004993;">IllegalOperationError</span>;
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.events</span>.<span style="color: #004993;">Event</span>;
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.events</span>.<span style="color: #004993;">HTTPStatusEvent</span>;
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.events</span>.<span style="color: #004993;">IOErrorEvent</span>;
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.events</span>.<span style="color: #004993;">SecurityErrorEvent</span>;
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.net</span>.<span style="color: #004993;">URLLoader</span>;
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.net</span>.<span style="color: #004993;">URLRequest</span>;
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.net</span>.<span style="color: #004993;">navigateToURL</span>;
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.external</span>.<span style="color: #004993;">ExternalInterface</span>;
&nbsp;
	<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #9900cc; font-weight: bold;">class</span> Share <span style="color: #000000;">&#123;</span> 
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">public</span> static const BITLY_USERNAME<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">String</span> 	= <span style="color: #990000;">&quot;&quot;</span>;
		<span style="color: #0033ff; font-weight: bold;">public</span> static const BITLY_API_KEY<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">String</span>	= <span style="color: #990000;">&quot;&quot;</span>;
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #6699cc; font-weight: bold;">var</span> title<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">String</span> 		= <span style="color: #990000;">&quot;&quot;</span>;
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #6699cc; font-weight: bold;">var</span> <span style="color: #004993;">description</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">String</span> 	= <span style="color: #990000;">&quot;&quot;</span>;
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #6699cc; font-weight: bold;">var</span> tweet_text<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">String</span>	= <span style="color: #990000;">&quot;&quot;</span>;
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #6699cc; font-weight: bold;">var</span> bitlyURL<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">String</span>;
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> _window_location<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">String</span>;
&nbsp;
&nbsp;
		<span style="color: #3f5fbf;">/**
		 * The Singleton instance of the ShareManager to use when accessing properties and methods of the ShareManager.
		 */</span>		
		<span style="color: #0033ff; font-weight: bold;">public</span> static const instance<span style="color: #000000; font-weight: bold;">:</span>Share = <span style="color: #0033ff; font-weight: bold;">new</span> Share<span style="color: #000000;">&#40;</span> ShareSingletonLock <span style="color: #000000;">&#41;</span>;
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> Share<span style="color: #000000;">&#40;</span> <span style="color: #004993;">lock</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Class</span> <span style="color: #000000;">&#41;</span><span style="color: #000000;">&#123;</span>
			<span style="color: #0033ff; font-weight: bold;">if</span><span style="color: #000000;">&#40;</span> <span style="color: #004993;">lock</span> <span style="color: #000000; font-weight: bold;">!</span>= ShareSingletonLock <span style="color: #000000;">&#41;</span><span style="color: #000000;">&#123;</span>
				<span style="color: #0033ff; font-weight: bold;">throw</span> <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">IllegalOperationError</span><span style="color: #000000;">&#40;</span> <span style="color: #990000;">&quot;ShareManager is a Singleton, please use the static instance method instead.&quot;</span> <span style="color: #000000;">&#41;</span>;
			<span style="color: #000000;">&#125;</span><span style="color: #0033ff; font-weight: bold;">else</span><span style="color: #000000;">&#123;</span>
				_window_location = <span style="color: #004993;">ExternalInterface</span>.<span style="color: #004993;">call</span><span style="color: #000000;">&#40;</span> <span style="color: #990000;">&quot;function () { return window.location.href.toString().toLowerCase(); }&quot;</span> <span style="color: #000000;">&#41;</span>;
				<span style="color: #0033ff; font-weight: bold;">if</span><span style="color: #000000;">&#40;</span> _window_location <span style="color: #000000; font-weight: bold;">!</span>= <span style="color: #990000;">&quot;&quot;</span> <span style="color: #000000;">&#41;</span><span style="color: #000000;">&#123;</span>
					<span style="color: #0033ff; font-weight: bold;">try</span><span style="color: #000000;">&#123;</span>
						getBitlyURL<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
					<span style="color: #000000;">&#125;</span><span style="color: #0033ff; font-weight: bold;">catch</span><span style="color: #000000;">&#40;</span> e<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Error</span> <span style="color: #000000;">&#41;</span><span style="color: #000000;">&#123;</span>
						<span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span> <span style="color: #990000;">&quot;ShareManager::Constructor &gt; error getting bitly url: &quot;</span> <span style="color: #000000; font-weight: bold;">+</span> getBitlyURL<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span>;
					<span style="color: #000000;">&#125;</span>
				<span style="color: #000000;">&#125;</span>
			<span style="color: #000000;">&#125;</span>
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> <span style="color: #004993;">init</span><span style="color: #000000;">&#40;</span> title<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">String</span>, <span style="color: #004993;">description</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">String</span>, tweet_text<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">String</span> <span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span> <span style="color: #000000;">&#123;</span>
			<span style="color: #0033ff; font-weight: bold;">this</span>.title			= title;
			<span style="color: #0033ff; font-weight: bold;">this</span>.<span style="color: #004993;">description</span>	= <span style="color: #004993;">description</span>;
			<span style="color: #0033ff; font-weight: bold;">this</span>.tweet_text		= tweet_text;
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> getBitlyURL<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span> <span style="color: #000000;">&#123;</span>
			<span style="color: #6699cc; font-weight: bold;">var</span> bitly_api<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">String</span>	= <span style="color: #990000;">&quot;http://api.bit.ly/shorten?version=2.0.1&amp;longUrl=&quot;</span>;
			bitly_api 				<span style="color: #000000; font-weight: bold;">+</span>= <span style="color: #004993;">encodeURIComponent</span><span style="color: #000000;">&#40;</span> _window_location <span style="color: #000000;">&#41;</span>;
			bitly_api 				<span style="color: #000000; font-weight: bold;">+</span>= <span style="color: #990000;">&quot;&amp;login=&quot;</span> <span style="color: #000000; font-weight: bold;">+</span> BITLY_USERNAME;
			bitly_api 				<span style="color: #000000; font-weight: bold;">+</span>= <span style="color: #990000;">&quot;&amp;apiKey=&quot;</span> <span style="color: #000000; font-weight: bold;">+</span> BITLY_API_KEY;
&nbsp;
			<span style="color: #6699cc; font-weight: bold;">var</span> <span style="color: #004993;">loader</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">URLLoader</span> = <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">URLLoader</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
			<span style="color: #004993;">loader</span>.<span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span> <span style="color: #004993;">Event</span>.<span style="color: #004993;">COMPLETE</span>, handleBitlyComplete <span style="color: #000000;">&#41;</span>;
			<span style="color: #004993;">loader</span>.<span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span> <span style="color: #004993;">HTTPStatusEvent</span>.<span style="color: #004993;">HTTP_STATUS</span>, handleBitlyStatus <span style="color: #000000;">&#41;</span>;
			<span style="color: #004993;">loader</span>.<span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span> <span style="color: #004993;">IOErrorEvent</span>.<span style="color: #004993;">IO_ERROR</span>, handleBitlyError <span style="color: #000000;">&#41;</span>;
			<span style="color: #004993;">loader</span>.<span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span> <span style="color: #004993;">SecurityErrorEvent</span>.<span style="color: #004993;">SECURITY_ERROR</span>, handleBitlyError <span style="color: #000000;">&#41;</span>;
			<span style="color: #004993;">loader</span>.<span style="color: #004993;">load</span><span style="color: #000000;">&#40;</span> <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">URLRequest</span><span style="color: #000000;">&#40;</span> bitly_api <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span>;
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> handleBitlyComplete<span style="color: #000000;">&#40;</span> e<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Event</span> <span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span> <span style="color: #000000;">&#123;</span>
			<span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span> <span style="color: #990000;">'BITLY url load complete: '</span> <span style="color: #000000; font-weight: bold;">+</span> e <span style="color: #000000;">&#41;</span>;
			<span style="color: #6699cc; font-weight: bold;">var</span> <span style="color: #004993;">loader</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">URLLoader</span> = e.<span style="color: #004993;">target</span> <span style="color: #0033ff; font-weight: bold;">as</span> <span style="color: #004993;">URLLoader</span>;
			<span style="color: #0033ff; font-weight: bold;">try</span><span style="color: #000000;">&#123;</span>
				<span style="color: #6699cc; font-weight: bold;">var</span> response<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Object</span> = <span style="color: #004993;">ExternalInterface</span>.<span style="color: #004993;">call</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;function(){return &quot;</span> <span style="color: #000000; font-weight: bold;">+</span> <span style="color: #000000;">&#40;</span> <span style="color: #004993;">loader</span>.<span style="color: #004993;">data</span> <span style="color: #0033ff; font-weight: bold;">as</span> <span style="color: #004993;">String</span> <span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">+</span> <span style="color: #990000;">&quot;}&quot;</span><span style="color: #000000;">&#41;</span>;
				<span style="color: #0033ff; font-weight: bold;">if</span><span style="color: #000000;">&#40;</span> response.statusCode == <span style="color: #990000;">&quot;OK&quot;</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> response.results<span style="color: #000000;">&#91;</span> _window_location <span style="color: #000000;">&#93;</span> <span style="color: #000000; font-weight: bold;">!</span>= <span style="color: #0033ff; font-weight: bold;">null</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> response.results<span style="color: #000000;">&#91;</span> _window_location <span style="color: #000000;">&#93;</span>.errorCode == <span style="color: #0033ff; font-weight: bold;">null</span> <span style="color: #000000;">&#41;</span><span style="color: #000000;">&#123;</span>
					bitlyURL = response.results<span style="color: #000000;">&#91;</span> _window_location<span style="color: #000000;">&#93;</span>.shortUrl;
					<span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span> <span style="color: #990000;">'Set BITLY url to: '</span> <span style="color: #000000; font-weight: bold;">+</span> bitlyURL <span style="color: #000000;">&#41;</span>;
				<span style="color: #000000;">&#125;</span>
			<span style="color: #000000;">&#125;</span><span style="color: #0033ff; font-weight: bold;">catch</span><span style="color: #000000;">&#40;</span> e<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Error</span> <span style="color: #000000;">&#41;</span><span style="color: #000000;">&#123;</span>
				<span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span> <span style="color: #990000;">&quot;Error decoding BITLY response (&quot;</span> <span style="color: #000000; font-weight: bold;">+</span> <span style="color: #004993;">loader</span>.<span style="color: #004993;">data</span> <span style="color: #000000; font-weight: bold;">+</span> <span style="color: #990000;">&quot;): &quot;</span> <span style="color: #000000; font-weight: bold;">+</span> e <span style="color: #000000;">&#41;</span>;
			<span style="color: #000000;">&#125;</span>
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> handleBitlyStatus<span style="color: #000000;">&#40;</span> e<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">HTTPStatusEvent</span> <span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span> <span style="color: #000000;">&#123;</span>
			<span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span> <span style="color: #990000;">'BITLY status: '</span> <span style="color: #000000; font-weight: bold;">+</span> e <span style="color: #000000;">&#41;</span>;	
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> handleBitlyError<span style="color: #000000;">&#40;</span> e<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Event</span> <span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span> <span style="color: #000000;">&#123;</span>
			<span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span> <span style="color: #990000;">'Getting BITLY url failed with error: '</span> <span style="color: #000000; font-weight: bold;">+</span> e <span style="color: #000000;">&#41;</span>;
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> <span style="color: #0033ff; font-weight: bold;">get</span> redditURL<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">String</span> <span style="color: #000000;">&#123;</span>
			<span style="color: #0033ff; font-weight: bold;">return</span> <span style="color: #990000;">'http://www.reddit.com/submit?url='</span> <span style="color: #000000; font-weight: bold;">+</span> <span style="color: #004993;">encodeURIComponent</span><span style="color: #000000;">&#40;</span> _window_location <span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">+</span> <span style="color: #990000;">&quot;&amp;title=&quot;</span> <span style="color: #000000; font-weight: bold;">+</span> <span style="color: #004993;">encodeURIComponent</span><span style="color: #000000;">&#40;</span> title <span style="color: #000000;">&#41;</span>;
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> openReddit<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span> <span style="color: #000000;">&#123;</span>
			<span style="color: #004993;">navigateToURL</span><span style="color: #000000;">&#40;</span> <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">URLRequest</span><span style="color: #000000;">&#40;</span> redditURL <span style="color: #000000;">&#41;</span>, <span style="color: #990000;">'_blank'</span> <span style="color: #000000;">&#41;</span>;
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> <span style="color: #0033ff; font-weight: bold;">get</span> diggURL<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">String</span> <span style="color: #000000;">&#123;</span>
			<span style="color: #6699cc; font-weight: bold;">var</span> <span style="color: #004993;">url</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">String</span> = <span style="color: #990000;">&quot;http://digg.com/submit?url=&quot;</span> <span style="color: #000000; font-weight: bold;">+</span> <span style="color: #004993;">encodeURIComponent</span><span style="color: #000000;">&#40;</span> _window_location <span style="color: #000000;">&#41;</span>;
			<span style="color: #004993;">url</span> <span style="color: #000000; font-weight: bold;">+</span>= <span style="color: #990000;">&quot;&amp;title=&quot;</span>    <span style="color: #000000; font-weight: bold;">+</span> <span style="color: #004993;">encodeURIComponent</span><span style="color: #000000;">&#40;</span> title <span style="color: #000000;">&#41;</span>;
			<span style="color: #004993;">url</span> <span style="color: #000000; font-weight: bold;">+</span>= <span style="color: #990000;">&quot;&amp;bodytext=&quot;</span> <span style="color: #000000; font-weight: bold;">+</span> <span style="color: #004993;">encodeURIComponent</span><span style="color: #000000;">&#40;</span> <span style="color: #004993;">description</span> <span style="color: #000000;">&#41;</span>;
			<span style="color: #004993;">url</span> <span style="color: #000000; font-weight: bold;">+</span>= <span style="color: #990000;">&quot;&amp;media=video&quot;</span>;
			<span style="color: #0033ff; font-weight: bold;">return</span> <span style="color: #004993;">url</span>;
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> openDigg<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span> <span style="color: #000000;">&#123;</span>
			<span style="color: #004993;">navigateToURL</span><span style="color: #000000;">&#40;</span> <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">URLRequest</span><span style="color: #000000;">&#40;</span> diggURL <span style="color: #000000;">&#41;</span>, <span style="color: #990000;">'_blank'</span> <span style="color: #000000;">&#41;</span>;
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> <span style="color: #0033ff; font-weight: bold;">get</span> twitterURL<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">String</span> <span style="color: #000000;">&#123;</span>
			<span style="color: #6699cc; font-weight: bold;">var</span> url_for_tweet<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">String</span>  	= bitlyURL <span style="color: #000000; font-weight: bold;">?</span> bitlyURL <span style="color: #000000; font-weight: bold;">:</span> _window_location;
			<span style="color: #6699cc; font-weight: bold;">var</span> twitter_status<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">String</span> 	= <span style="color: #004993;">encodeURIComponent</span><span style="color: #000000;">&#40;</span> tweet_text <span style="color: #000000;">&#41;</span>;
			<span style="color: #0033ff; font-weight: bold;">return</span> <span style="color: #990000;">&quot;http://twitter.com/home/?status=&quot;</span> <span style="color: #000000; font-weight: bold;">+</span> twitter_status;
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> openTwitter<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span> <span style="color: #000000;">&#123;</span>
			<span style="color: #004993;">navigateToURL</span><span style="color: #000000;">&#40;</span> <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">URLRequest</span><span style="color: #000000;">&#40;</span> twitterURL <span style="color: #000000;">&#41;</span>, <span style="color: #990000;">'_blank'</span> <span style="color: #000000;">&#41;</span>;
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> <span style="color: #0033ff; font-weight: bold;">get</span> mySpaceURL<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">String</span> <span style="color: #000000;">&#123;</span>
			<span style="color: #6699cc; font-weight: bold;">var</span> <span style="color: #004993;">url</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">String</span> = <span style="color: #990000;">&quot;http://www.myspace.com/index.cfm?fuseaction=postto&quot;</span>;
			<span style="color: #004993;">url</span> <span style="color: #000000; font-weight: bold;">+</span>= <span style="color: #990000;">&quot;&amp;t=&quot;</span> <span style="color: #000000; font-weight: bold;">+</span> <span style="color: #004993;">encodeURIComponent</span><span style="color: #000000;">&#40;</span> title <span style="color: #000000;">&#41;</span>;
			<span style="color: #004993;">url</span> <span style="color: #000000; font-weight: bold;">+</span>= <span style="color: #990000;">&quot;&amp;c=&quot;</span> <span style="color: #000000; font-weight: bold;">+</span> <span style="color: #004993;">encodeURIComponent</span><span style="color: #000000;">&#40;</span> <span style="color: #004993;">description</span> <span style="color: #000000;">&#41;</span>;
			<span style="color: #004993;">url</span> <span style="color: #000000; font-weight: bold;">+</span>= <span style="color: #990000;">&quot;&amp;u=&quot;</span> <span style="color: #000000; font-weight: bold;">+</span> <span style="color: #004993;">encodeURIComponent</span><span style="color: #000000;">&#40;</span> _window_location <span style="color: #000000;">&#41;</span>;
			<span style="color: #004993;">url</span> <span style="color: #000000; font-weight: bold;">+</span>= <span style="color: #990000;">&quot;&amp;r=close&quot;</span>;
			<span style="color: #0033ff; font-weight: bold;">return</span> <span style="color: #004993;">url</span>;
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> openMySpace<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span> <span style="color: #000000;">&#123;</span>
			<span style="color: #004993;">navigateToURL</span><span style="color: #000000;">&#40;</span> <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">URLRequest</span><span style="color: #000000;">&#40;</span> mySpaceURL <span style="color: #000000;">&#41;</span>, <span style="color: #990000;">'_blank'</span> <span style="color: #000000;">&#41;</span>;
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> <span style="color: #0033ff; font-weight: bold;">get</span> facebookURL<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">String</span> <span style="color: #000000;">&#123;</span>
			<span style="color: #6699cc; font-weight: bold;">var</span> <span style="color: #004993;">url</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">String</span> = <span style="color: #990000;">&quot;http://www.facebook.com/share.php?src=bm&amp;v=4&amp;i=1254383639&quot;</span>;
			<span style="color: #004993;">url</span> <span style="color: #000000; font-weight: bold;">+</span>= <span style="color: #990000;">&quot;&amp;u=&quot;</span> <span style="color: #000000; font-weight: bold;">+</span> <span style="color: #004993;">encodeURIComponent</span><span style="color: #000000;">&#40;</span> _window_location <span style="color: #000000;">&#41;</span>;
			<span style="color: #004993;">url</span> <span style="color: #000000; font-weight: bold;">+</span>= <span style="color: #990000;">&quot;&amp;t=&quot;</span> <span style="color: #000000; font-weight: bold;">+</span> <span style="color: #004993;">encodeURIComponent</span><span style="color: #000000;">&#40;</span> title <span style="color: #000000;">&#41;</span>;
			<span style="color: #0033ff; font-weight: bold;">return</span> <span style="color: #004993;">url</span>;
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> openFacebook<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span> <span style="color: #000000;">&#123;</span>
			<span style="color: #004993;">navigateToURL</span><span style="color: #000000;">&#40;</span> <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">URLRequest</span><span style="color: #000000;">&#40;</span> facebookURL <span style="color: #000000;">&#41;</span>, <span style="color: #990000;">'_blank'</span> <span style="color: #000000;">&#41;</span>;
		<span style="color: #000000;">&#125;</span>
&nbsp;
	<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #9900cc; font-weight: bold;">class</span> ShareSingletonLock <span style="color: #000000;">&#123;</span><span style="color: #000000;">&#125;</span></pre></td></tr></table></div>

<p>If you&#8217;ve created your own sharing API or you improve the above write it up and let me know in the comments!</p>
]]></content:encoded>
			<wfw:commentRss>http://ianserlin.com/index.php/2009/12/18/adding-facebook-twitter-myspace-digg-reddit-bitly-share-functionality-to-your-actionscript-3flex-application/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

