<?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>Flex Examples &#187; setClipboard()</title>
	<atom:link href="http://blog.flexexamples.com/tag/setclipboard/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.flexexamples.com</link>
	<description>Just a bunch of Adobe Flex Examples</description>
	<lastBuildDate>Wed, 26 Jan 2011 18:09:51 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Copying text to the operating system clipboard in Flex</title>
		<link>http://blog.flexexamples.com/2008/01/30/copying-text-to-the-operating-system-clipboard-in-flex/</link>
		<comments>http://blog.flexexamples.com/2008/01/30/copying-text-to-the-operating-system-clipboard-in-flex/#comments</comments>
		<pubDate>Thu, 31 Jan 2008 06:43:53 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[System]]></category>
		<category><![CDATA[setClipboard()]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2008/01/30/copying-text-to-the-operating-system-clipboard-in-flex/</guid>
		<description><![CDATA[<p>The following example shows you how you can copy text from a Flex application to the operating system&#8217;s clipboard by using the static System.setClipboard() method.</p> <p>Full code after the jump.</p> <p></p> &#60;?xml version=&#34;1.0&#34; encoding=&#34;utf-8&#34;?&#62; &#60;!-- http://blog.flexexamples.com/2008/01/30/copying-text-to-the-operating-system-clipboard-in-flex/ --&#62; &#60;mx:Application xmlns:mx=&#34;http://www.adobe.com/2006/mxml&#34; layout=&#34;vertical&#34; verticalAlign=&#34;middle&#34; backgroundColor=&#34;white&#34;&#62; &#160; &#60;mx:Script&#62; &#60;![CDATA[ import mx.controls.Alert; &#160; private function button_click():void { System.setClipboard(richTextEditor.text); Alert.show(&#34;Done&#34;); } [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows you how you can copy text from a Flex application to the operating system&#8217;s clipboard by using the static <code>System.setClipboard()</code> method.</p>
<p>Full code after the jump.</p>
<p><span id="more-497"></span></p>

<div class="wp_syntax"><div class="code"><pre class="mxml" style="font-family:monospace;"><span style="color: #000000;">&lt;?xml version=<span style="color: #ff0000;">&quot;1.0&quot;</span> encoding=<span style="color: #ff0000;">&quot;utf-8&quot;</span>?<span style="color: #7400FF;">&gt;</span></span>
<span style="color: #000000;"><span style="color: #808080; font-style: italic;">&lt;!-- http://blog.flexexamples.com/2008/01/30/copying-text-to-the-operating-system-clipboard-in-flex/ --&gt;</span></span>
<span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Application</span> xmlns:mx=<span style="color: #ff0000;">&quot;http://www.adobe.com/2006/mxml&quot;</span></span>
<span style="color: #000000;">        layout=<span style="color: #ff0000;">&quot;vertical&quot;</span></span>
<span style="color: #000000;">        verticalAlign=<span style="color: #ff0000;">&quot;middle&quot;</span></span>
<span style="color: #000000;">        backgroundColor=<span style="color: #ff0000;">&quot;white&quot;</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #339933;">&lt;mx:Script&gt;</span>
<span style="color: #339933;">        &lt;![CDATA[</span>
<span style="color: #339933;">            import mx.controls.Alert;</span>
&nbsp;
<span style="color: #339933;">            private function button_click():void {</span>
<span style="color: #339933;">                System.setClipboard(richTextEditor.text);</span>
<span style="color: #339933;">                Alert.show(&quot;Done&quot;);</span>
<span style="color: #339933;">            }</span>
<span style="color: #339933;">        ]]&gt;</span>
<span style="color: #339933;">    &lt;/mx:Script&gt;</span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:ApplicationControlBar</span> dock=<span style="color: #ff0000;">&quot;true&quot;</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Button</span> id=<span style="color: #ff0000;">&quot;button&quot;</span></span>
<span style="color: #000000;">                label=<span style="color: #ff0000;">&quot;Copy text to clipboard&quot;</span></span>
<span style="color: #000000;">                toolTip=<span style="color: #ff0000;">&quot;Click here to copy the contents of the RichTextEditor control to the OS clipboard.&quot;</span></span>
<span style="color: #000000;">                click=<span style="color: #ff0000;">&quot;button_click();&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:ApplicationControlBar</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:RichTextEditor</span> id=<span style="color: #ff0000;">&quot;richTextEditor&quot;</span></span>
<span style="color: #000000;">            text=<span style="color: #ff0000;">&quot;The quick brown fox jumped over the lazy dog.&quot;</span></span>
<span style="color: #000000;">            width=<span style="color: #ff0000;">&quot;100%&quot;</span></span>
<span style="color: #000000;">            height=<span style="color: #ff0000;">&quot;100%&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
&nbsp;
<span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:Application</span><span style="color: #7400FF;">&gt;</span></span></pre></div></div>

<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/System_setClipboard_test/bin/srcview/index.html">View source</a> is enabled in the following example.</p>
<p><iframe src="http://blog.flexexamples.com/wp-content/uploads/System_setClipboard_test/bin/main.html" width="100%" height="350"></iframe></p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Copying text to the operating system clipboard in Flex on FlexExamples.com',url: 'http://blog.flexexamples.com/2008/01/30/copying-text-to-the-operating-system-clipboard-in-flex/',contentID: 'post-497',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'setClipboard()',providerName: 'FlexExamples.com',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper-remember.png" class="evernoteSiteMemoryButton" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div>]]></content:encoded>
			<wfw:commentRss>http://blog.flexexamples.com/2008/01/30/copying-text-to-the-operating-system-clipboard-in-flex/feed/</wfw:commentRss>
		<slash:comments>23</slash:comments>
		</item>
		<item>
		<title>Converting an ImageSnapshot object into a Base-64 encoded string in Flex 3</title>
		<link>http://blog.flexexamples.com/2007/12/07/converting-an-imagesnapshot-object-into-a-base-64-encoded-string-in-flex-3/</link>
		<comments>http://blog.flexexamples.com/2007/12/07/converting-an-imagesnapshot-object-into-a-base-64-encoded-string-in-flex-3/#comments</comments>
		<pubDate>Sat, 08 Dec 2007 06:32:25 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[ImageSnapshot]]></category>
		<category><![CDATA[captureImage()]]></category>
		<category><![CDATA[encodeImageAsBase64()]]></category>
		<category><![CDATA[setClipboard()]]></category>
		<category><![CDATA[setSelection()]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2007/12/07/converting-an-imagesnapshot-object-into-a-base-64-encoded-string-in-flex-3/</guid>
		<description><![CDATA[<p>The following example shows how you can convert an ImageSnapshot object into a Base-64 encoded string using Flex 3&#8242;s cleverly named encodeImageAsBase64() method.</p> <p>Full code after the jump.</p> <p></p> <p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/ImageSnapshot_encodeImageAsBase64_test/main.mxml">View MXML</a></p> &#60;?xml version="1.0" encoding="utf-8"?&#62; &#60;!-- http://blog.flexexamples.com/2007/12/07/converting-an-imagesnapshot-object-into-a-base-64-encoded-string-in-flex-3/ --&#62; &#60;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" verticalAlign="middle" backgroundColor="white"&#62; &#60;mx:Script&#62; &#60;![CDATA[ import flash.events.FocusEvent; import flash.system.System; import mx.graphics.ImageSnapshot; private function button_click(evt:MouseEvent):void [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows how you can convert an ImageSnapshot object into a Base-64 encoded string using Flex 3&#8242;s cleverly named <code>encodeImageAsBase64()</code> method.</p>
<p>Full code after the jump.</p>
<p><span id="more-354"></span></p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/ImageSnapshot_encodeImageAsBase64_test/main.mxml">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2007/12/07/converting-an-imagesnapshot-object-into-a-base-64-encoded-string-in-flex-3/ --&gt;
&lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"&gt;

    &lt;mx:Script&gt;
        &lt;![CDATA[
            import flash.events.FocusEvent;
            import flash.system.System;
            import mx.graphics.ImageSnapshot;

            private function button_click(evt:MouseEvent):void {
                var ohSnap:ImageSnapshot = ImageSnapshot.captureImage(img);
                textArea.text = ImageSnapshot.encodeImageAsBase64(ohSnap);
            }

            private function textArea_focusIn(evt:FocusEvent):void {
                textArea.setSelection(0, textArea.text.length);
            }
        ]]&gt;
    &lt;/mx:Script&gt;

    &lt;mx:ApplicationControlBar dock="true"&gt;
        &lt;mx:Button label="Capture and encode"
                click="button_click(event);" /&gt;
    &lt;/mx:ApplicationControlBar&gt;

    &lt;mx:Form&gt;
        &lt;mx:FormItem label="source:"&gt;
            &lt;mx:Image id="img"
                    source="@Embed('images/flex_logo.jpg')" /&gt;
        &lt;/mx:FormItem&gt;
        &lt;mx:FormItem label="Base64:"&gt;
            &lt;mx:TextArea id="textArea"
                    editable="false"
                    showScrollTips="true"
                    width="320"
                    height="160"
                    focusIn="textArea_focusIn(event);" /&gt;
        &lt;/mx:FormItem&gt;
        &lt;mx:FormItem&gt;
            &lt;mx:Button label="Copy to clipboard"
                    enabled="{textArea.text.length &gt; 0}"
                    click="System.setClipboard(textArea.text);" /&gt;
        &lt;/mx:FormItem&gt;
    &lt;/mx:Form&gt;

&lt;/mx:Application&gt;
</pre>
<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/ImageSnapshot_encodeImageAsBase64_test/bin/srcview/index.html">View source</a> is enabled in the following example.</p>
<p><iframe src="http://blog.flexexamples.com/wp-content/uploads/ImageSnapshot_encodeImageAsBase64_test/bin/main.html" width="100%" height="400"></iframe></p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Converting an ImageSnapshot object into a Base-64 encoded string in Flex 3 on FlexExamples.com',url: 'http://blog.flexexamples.com/2007/12/07/converting-an-imagesnapshot-object-into-a-base-64-encoded-string-in-flex-3/',contentID: 'post-354',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'captureImage(),encodeImageAsBase64(),setClipboard(),setSelection()',providerName: 'FlexExamples.com',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper-remember.png" class="evernoteSiteMemoryButton" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div>]]></content:encoded>
			<wfw:commentRss>http://blog.flexexamples.com/2007/12/07/converting-an-imagesnapshot-object-into-a-base-64-encoded-string-in-flex-3/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>

