Flex中如何利用System.setClipboard()函数复制Flex应用程序中的文本到系统粘贴版上的例子
By Minidxer | March 13, 2009
接下来的例子演示了Flex中如何利用System.setClipboard()函数,复制Flex应用程序中的文本到系统粘贴版上。
让我们先来看一下Demo(可以右键View Source或点击这里察看源代码):
下面是完整代码(或点击这里察看):
Download: main.mxml
- <?xml version="1.0" encoding="utf-8"?>
- <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
- layout="vertical"
- verticalAlign="middle"
- backgroundColor="white">
- <mx:Script>
- <![CDATA[
- import mx.controls.Alert;
- private function button_click():void {
- System.setClipboard(richTextEditor.text);
- Alert.show("Done");
- }
- ]]>
- </mx:Script>
- <mx:ApplicationControlBar dock="true">
- <mx:Button id="button"
- label="Copy text to clipboard"
- toolTip="Click here to copy the contents of the RichTextEditor control to the OS clipboard."
- click="button_click();" />
- </mx:ApplicationControlBar>
- <mx:RichTextEditor id="richTextEditor"
- text="The quick brown fox jumped over the lazy dog."
- width="100%"
- height="100%" />
- </mx:Application>
代码:Peter deHaan 翻译/整理/编译:中文Flex例子
Topics:
Other |
3 Comments » |
Tags: setClipboard, System
例子贴错了~~
呃,果然。。。贴错目录了
谢谢哈
路过 观望一下强人