当前位置:主页>Flex>文章内容
  • 在Flex中复制文字到操作系统的剪贴板
  • 来源:N神AS研究所 作者:N神AS研究所 2008-03-09 【
这个实例演示了怎么样使用System.setClipboard()静态方法,从一个Flex application中复制文字到操作系统的剪贴板。
随便在RichTextEditor打些字,然后点击Copy text to clipboard 按钮就复制到剪贴板了,之后就找个能打文本的地方试试吧
先看演示:

完整的代码见这里:
<?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:RichTextEditor id="richTextEditor"
 text="The quick brown fox jumped over the lazy dog."
 width="100%"
 height="160" />

 <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:Application>

[exclaim] 这里查看MXML

此文已经被收录在 《Flex 3 常见组件使用技巧系列 》中,点此进入该主题。




上一篇:用Validator检测数字、字符串、Email、电话号码等   下一篇:yahoo发布了一款Flex皮肤,提供下载
  • 用户名:新注册) 密码: 匿名评论
  • 评论内容:(不能超过250字,需审核后才会公布,请自觉遵守互联网相关政策法规)

Copyright © 2006-2008 flashas.net All Rights Reserved.
网站内容咨询: admin#flashas.net (#为@) 联系QQ:40777822 浙ICP备06033001号
(本网站最佳浏览解析度为1024*768, 建议使用IE 6.0或以上版本浏览器。)