小小菜鸟的web菜园子

web开发学习。好记性不如烂笔头。每天进步一点点!

导航

在FLEX中,拷贝文本内容到剪贴板.

<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2008/01/30/copying-text-to-the-operating-system-clipboard-in-flex/ -->
<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>

来自:http://blog.flexexamples.com/2008/01/30/copying-text-to-the-operating-system-clipboard-in-flex/

利用事件拷贝,

posted on 2008-04-05 20:07  『小小菜鸟』  阅读(651)  评论(0编辑  收藏  举报