Flex Gumbo中如何通过selectAll函数检测用户是否用Ctrl+A/Command+A或菜单项选中FxTextArea的例子

By Minidxer | May 27, 2009

接下来的例子演示了Flex Gumbo中如何通过selectAll函数,检测用户是否用Ctrl+A/Command+A或菜单项选中FxTextArea。

让我们先来看一下Demo可以右键View Source或点击这里察看源代码):


下面是完整代码(或点击这里察看):

Download: main.mxml
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <Application name="FxTextArea_selectAll_test"
  3.         xmlns="http://ns.adobe.com/mxml/2009"
  4.         layout="vertical"
  5.         verticalAlign="middle"
  6.         backgroundColor="white">
  7.  
  8.     <Script>
  9.         <![CDATA[
  10.             import mx.controls.Alert;
  11.  
  12.             private function textArea_selectAll(evt:Event):void {
  13.                 Alert.show(evt.type);
  14.             }
  15.         ]]>
  16.     </Script>
  17.  
  18.     <Label text="Right-click the FxTextArea control below and select 'Select All' from the context menu." />
  19.     <FxTextArea id="textArea"
  20.             width="100%"
  21.             height="100%"
  22.             selectAll="textArea_selectAll(event);">
  23.         <content>
  24.             <String source="data/lorem.html" />
  25.         </content>
  26.     </FxTextArea>
  27.  
  28. </Application>
代码:Peter deHaan 翻译/整理/编译:中文Flex例子

Topics: FxTextArea, Gumbo | No Comments » | Tags: , ,

Search Posts