<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Copying text to the operating system clipboard in Flex</title>
	<atom:link href="http://blog.flexexamples.com/2008/01/30/copying-text-to-the-operating-system-clipboard-in-flex/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.flexexamples.com/2008/01/30/copying-text-to-the-operating-system-clipboard-in-flex/</link>
	<description>Just a bunch of Adobe Flex Examples</description>
	<lastBuildDate>Sun, 12 Feb 2012 14:19:03 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: prithveesingh</title>
		<link>http://blog.flexexamples.com/2008/01/30/copying-text-to-the-operating-system-clipboard-in-flex/comment-page-1/#comment-10375</link>
		<dc:creator>prithveesingh</dc:creator>
		<pubDate>Wed, 08 Feb 2012 12:51:09 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2008/01/30/copying-text-to-the-operating-system-clipboard-in-flex/#comment-10375</guid>
		<description>How to copy only selected text instead of whole text?</description>
		<content:encoded><![CDATA[<p>How to copy only selected text instead of whole text?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chuck</title>
		<link>http://blog.flexexamples.com/2008/01/30/copying-text-to-the-operating-system-clipboard-in-flex/comment-page-1/#comment-8243</link>
		<dc:creator>Chuck</dc:creator>
		<pubDate>Sun, 22 Aug 2010 15:36:39 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2008/01/30/copying-text-to-the-operating-system-clipboard-in-flex/#comment-8243</guid>
		<description>I have formmated text in my Flex 3.5 TextArea (line breaks) and when I copy this to the clipboard I lose the formatting.  Is there a way to maintain the formatting when copying to the clipboard?</description>
		<content:encoded><![CDATA[<p>I have formmated text in my Flex 3.5 TextArea (line breaks) and when I copy this to the clipboard I lose the formatting.  Is there a way to maintain the formatting when copying to the clipboard?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Puneet Tuli</title>
		<link>http://blog.flexexamples.com/2008/01/30/copying-text-to-the-operating-system-clipboard-in-flex/comment-page-1/#comment-7313</link>
		<dc:creator>Puneet Tuli</dc:creator>
		<pubDate>Mon, 22 Mar 2010 05:11:39 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2008/01/30/copying-text-to-the-operating-system-clipboard-in-flex/#comment-7313</guid>
		<description>Hi,

Nice Example. Very helpful for me!!!!

I need your help!!!

I want to perform cut, copy and paste operations in my application. How can I paste the text copied in the clipboard to the text area in flex appliaction. Waiting for your response!!!!!</description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>Nice Example. Very helpful for me!!!!</p>
<p>I need your help!!!</p>
<p>I want to perform cut, copy and paste operations in my application. How can I paste the text copied in the clipboard to the text area in flex appliaction. Waiting for your response!!!!!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: kolo</title>
		<link>http://blog.flexexamples.com/2008/01/30/copying-text-to-the-operating-system-clipboard-in-flex/comment-page-1/#comment-6890</link>
		<dc:creator>kolo</dc:creator>
		<pubDate>Sat, 30 Jan 2010 20:36:33 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2008/01/30/copying-text-to-the-operating-system-clipboard-in-flex/#comment-6890</guid>
		<description>OK I HAVE IT! Maybe it will help someone. It works only in IE but it works:D
FLex code:
&lt;pre lang=&quot;actionscript3&quot;&gt;
private function jsSend():void{
    if (ExternalInterface.available){
    	s=richTextEditor.text;
    	ExternalInterface.call(&quot;copyT&quot;,s);
    }
}
&lt;/pre&gt;

Javacript:
&lt;pre lang=&quot;javascript&quot;&gt;
function copyT(s)  
{  
    if(window.clipboardData)  
    {  
    window.clipboardData.setData(&#039;text&#039;,s);  
    }  
    else  
    {  
        var clipboarddiv=document.getElementById(&#039;divclipboardswf&#039;);  
    if(clipboarddiv==null)  
    {  
       clipboarddiv=document.createElement(&#039;div&#039;);  
           clipboarddiv.setAttribute(&quot;name&quot;, &quot;divclipboardswf&quot;);  
       clipboarddiv.setAttribute(&quot;id&quot;, &quot;divclipboardswf&quot;);  
       document.body.appendChild(clipboarddiv);  
    }  
        clipboarddiv.innerHTML=&#039;&#039;;  
    }  
    alert(&#039;The text is copied to your clipboard...&#039;);  
    return false;  
}
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>OK I HAVE IT! Maybe it will help someone. It works only in IE but it works:D<br />
FLex code:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> jsSend<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; 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;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #004993;">ExternalInterface</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">available</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#123;</span>
    	s=richTextEditor<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">text</span><span style="color: #000066; font-weight: bold;">;</span>
    	<span style="color: #004993;">ExternalInterface</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">call</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;copyT&quot;</span><span style="color: #000066; font-weight: bold;">,</span>s<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
    <span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>Javacript:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">function</span> copyT<span style="color: #009900;">&#40;</span>s<span style="color: #009900;">&#41;</span>  
<span style="color: #009900;">&#123;</span>  
    <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>window.<span style="color: #660066;">clipboardData</span><span style="color: #009900;">&#41;</span>  
    <span style="color: #009900;">&#123;</span>  
    window.<span style="color: #660066;">clipboardData</span>.<span style="color: #660066;">setData</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'text'</span><span style="color: #339933;">,</span>s<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>  
    <span style="color: #009900;">&#125;</span>  
    <span style="color: #000066; font-weight: bold;">else</span>  
    <span style="color: #009900;">&#123;</span>  
        <span style="color: #003366; font-weight: bold;">var</span> clipboarddiv<span style="color: #339933;">=</span>document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'divclipboardswf'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>  
    <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>clipboarddiv<span style="color: #339933;">==</span><span style="color: #003366; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span>  
    <span style="color: #009900;">&#123;</span>  
       clipboarddiv<span style="color: #339933;">=</span>document.<span style="color: #660066;">createElement</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'div'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>  
           clipboarddiv.<span style="color: #660066;">setAttribute</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;name&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;divclipboardswf&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>  
       clipboarddiv.<span style="color: #660066;">setAttribute</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;id&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;divclipboardswf&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>  
       document.<span style="color: #660066;">body</span>.<span style="color: #660066;">appendChild</span><span style="color: #009900;">&#40;</span>clipboarddiv<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>  
    <span style="color: #009900;">&#125;</span>  
        clipboarddiv.<span style="color: #660066;">innerHTML</span><span style="color: #339933;">=</span><span style="color: #3366CC;">''</span><span style="color: #339933;">;</span>  
    <span style="color: #009900;">&#125;</span>  
    <span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'The text is copied to your clipboard...'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>  
    <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">;</span>  
<span style="color: #009900;">&#125;</span></pre></div></div>

]]></content:encoded>
	</item>
	<item>
		<title>By: kolo</title>
		<link>http://blog.flexexamples.com/2008/01/30/copying-text-to-the-operating-system-clipboard-in-flex/comment-page-1/#comment-6885</link>
		<dc:creator>kolo</dc:creator>
		<pubDate>Sat, 30 Jan 2010 01:42:20 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2008/01/30/copying-text-to-the-operating-system-clipboard-in-flex/#comment-6885</guid>
		<description>THX for your help.</description>
		<content:encoded><![CDATA[<p>THX for your help.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: kolo</title>
		<link>http://blog.flexexamples.com/2008/01/30/copying-text-to-the-operating-system-clipboard-in-flex/comment-page-1/#comment-6884</link>
		<dc:creator>kolo</dc:creator>
		<pubDate>Sat, 30 Jan 2010 00:45:17 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2008/01/30/copying-text-to-the-operating-system-clipboard-in-flex/#comment-6884</guid>
		<description>I cant do click. I am doing a project for paralised people and they cant use their hands to do click.</description>
		<content:encoded><![CDATA[<p>I cant do click. I am doing a project for paralised people and they cant use their hands to do click.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Peter deHaan</title>
		<link>http://blog.flexexamples.com/2008/01/30/copying-text-to-the-operating-system-clipboard-in-flex/comment-page-1/#comment-6883</link>
		<dc:creator>Peter deHaan</dc:creator>
		<pubDate>Sat, 30 Jan 2010 00:28:30 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2008/01/30/copying-text-to-the-operating-system-clipboard-in-flex/#comment-6883</guid>
		<description>Yeah, I think by &quot;pop-up window&quot; they meant more like FileReference upload or download actions, full screen, and apparently clipboard access. Otherwise I assume when a SWF loaded, the rogue site could set you fullscreen, erase your clipboard contents, and try downloading a file.

Peter</description>
		<content:encoded><![CDATA[<p>Yeah, I think by &#8220;pop-up window&#8221; they meant more like FileReference upload or download actions, full screen, and apparently clipboard access. Otherwise I assume when a SWF loaded, the rogue site could set you fullscreen, erase your clipboard contents, and try downloading a file.</p>
<p>Peter</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Peter deHaan</title>
		<link>http://blog.flexexamples.com/2008/01/30/copying-text-to-the-operating-system-clipboard-in-flex/comment-page-1/#comment-6882</link>
		<dc:creator>Peter deHaan</dc:creator>
		<pubDate>Sat, 30 Jan 2010 00:26:17 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2008/01/30/copying-text-to-the-operating-system-clipboard-in-flex/#comment-6882</guid>
		<description>You should be able to do something using the &lt;code&gt;setSelection()&lt;/code&gt; method on the inner TextArea control, as seen in the following example:
&lt;pre lang=&quot;actionscript3&quot;&gt;
private function button_click():void {
    richTextEditor.textArea.setSelection(0, richTextEditor.text.length);
    System.setClipboard(richTextEditor.text);
    Alert.show(&quot;Done&quot;);
}
&lt;/pre&gt;

Peter</description>
		<content:encoded><![CDATA[<p>You should be able to do something using the <code>setSelection()</code> method on the inner TextArea control, as seen in the following example:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> button_click<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span> <span style="color: #000000;">&#123;</span>
    richTextEditor<span style="color: #000066; font-weight: bold;">.</span>textArea<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">setSelection</span><span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">,</span> richTextEditor<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">text</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">length</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
    <span style="color: #004993;">System</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">setClipboard</span><span style="color: #000000;">&#40;</span>richTextEditor<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">text</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
    Alert<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">show</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;Done&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>Peter</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Peter deHaan</title>
		<link>http://blog.flexexamples.com/2008/01/30/copying-text-to-the-operating-system-clipboard-in-flex/comment-page-1/#comment-6881</link>
		<dc:creator>Peter deHaan</dc:creator>
		<pubDate>Sat, 30 Jan 2010 00:23:15 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2008/01/30/copying-text-to-the-operating-system-clipboard-in-flex/#comment-6881</guid>
		<description>It may be possible to copy text to the clipboard using JavaScript, but I haven&#039;t looked at that in a long time, and I&#039;m not certain on how cross-browser friendly that would be (may require different setups for Firefox/IE/Safari/Chrome/Opera/etc). Once you figure out the JavaScript side, you could try calling the JS methods from ActionScript using the ExternalInterface class in a &lt;code&gt;rollOver&lt;/code&gt; event handler.

Or, just use a mouse &quot;click&quot; instead of &quot;rollOver&quot; and you&#039;re done. ;)

Peter</description>
		<content:encoded><![CDATA[<p>It may be possible to copy text to the clipboard using JavaScript, but I haven&#8217;t looked at that in a long time, and I&#8217;m not certain on how cross-browser friendly that would be (may require different setups for Firefox/IE/Safari/Chrome/Opera/etc). Once you figure out the JavaScript side, you could try calling the JS methods from ActionScript using the ExternalInterface class in a <code>rollOver</code> event handler.</p>
<p>Or, just use a mouse &#8220;click&#8221; instead of &#8220;rollOver&#8221; and you&#8217;re done. ;)</p>
<p>Peter</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: kolo</title>
		<link>http://blog.flexexamples.com/2008/01/30/copying-text-to-the-operating-system-clipboard-in-flex/comment-page-1/#comment-6880</link>
		<dc:creator>kolo</dc:creator>
		<pubDate>Sat, 30 Jan 2010 00:14:50 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2008/01/30/copying-text-to-the-operating-system-clipboard-in-flex/#comment-6880</guid>
		<description>Is it possible to do &quot;ctrl+a&quot; on text in RichTE with button?</description>
		<content:encoded><![CDATA[<p>Is it possible to do &#8220;ctrl+a&#8221; on text in RichTE with button?</p>
]]></content:encoded>
	</item>
</channel>
</rss>

