Flex 텍스트 편집기 코드 인 스 턴 스 생 성 및 온라인 실행 효과

블 로그 원래 주소:http://tongqiuyan.blog.163.com/blog/static/19554530220119162275231/
아래 flash 는 Flex 가 만 든 텍스트 편집기 실행 효과 가 있 습 니 다:
 
원본 코드 는 다음 과 같 습 니 다.

  
  
  
  
  1. <?xml version="1.0" encoding="utf-8"?>  
  2. <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="horizontal" fontSize="12">  
  3.     <mx:Script>  
  4.         <![CDATA[  
  5.             //   
  6.             import mx.controls.TextInput;  
  7.             import mx.controls.TextArea;  
  8.             import mx.events.FlexEvent;  
  9.             //   
  10.             private const MAX_CHARS:uint = 100;  
  11.             //   
  12.             private function richTextEditor_creationComplete(evt:FlexEvent):void  
  13.             {  
  14.                 RichTextEditor(evt.currentTarget).textArea.maxChars = MAX_CHARS;  
  15.             }  
  16.             //   
  17.             private function richTextEditor_change(evt:Event):void  
  18.             {  
  19.                 var rte:RichTextEditor = evt.currentTarget as RichTextEditor;  
  20.                 var rteTA:TextArea = rte.textArea as TextArea;  
  21.                 rte.status = rteTA.length + "/"+rteTA.maxChars;  
  22.             }  
  23.             //   
  24.             private function toogle_linkTextInput():void  
  25.             {  
  26.                 var textInput:TextInput = richTextEditor.linkTextInput;  
  27.                 var isSelected:Boolean = cbLinkButton.selected;  
  28.                 textInput.visible = isSelected;  
  29.                 textInput.includeInLayout = isSelected;  
  30.             }  
  31.         ]]>  
  32.     </mx:Script>  
  33.     <mx:Array id="fontFamilyArr">  
  34.         <mx:String>Arial</mx:String>  
  35.         <mx:String>Verdana</mx:String>  
  36.         <mx:String> </mx:String>  
  37.         <mx:String> </mx:String>  
  38.     </mx:Array>  
  39.     <mx:Panel width="650" height="400" layout="horizontal" title=" ">  
  40.         <mx:VBox height="100%" width="100%">  
  41.             <mx:ApplicationControlBar dock="true" width="100%">  
  42.                 <mx:CheckBox id="cbBar" label=" :" selected="true" />  
  43.                 <mx:CheckBox id="cbLinkButton" label=" :" selected="true" change="toogle_linkTextInput();" />  
  44.             </mx:ApplicationControlBar>  
  45.             <mx:RichTextEditor id="richTextEditor" width="100%" height="100%" title=" , 。" showToolTips="true" 
  46.                                fontFamilyToolTip=" " colorPickerToolTip=" " showControlBar="{cbBar.selected}" 
  47.                                change="richTextEditor_change(event);" creationComplete="richTextEditor_creationComplete(event);" 
  48.                                fontFamilyArray="{fontFamilyArr}">  
  49.             </mx:RichTextEditor>  
  50.         </mx:VBox>  
  51.     </mx:Panel>  
  52. </mx:Application>  

컨트롤 과 관련 된 것 은 주로 RichTextEditor, VBox, Panel 등 이다.

좋은 웹페이지 즐겨찾기