flex开发卡片文字编辑(五)

 
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml"   
  3.     creationComplete="initUI();" 
  4.     width="428" 
  5.     height="300" 
  6.     borderStyle="solid"
  7.      borderThickness="2" 
  8.      themeColor="#E9EFF3"   
  9.      backgroundColor="#E6E6E6" 
  10.      cornerRadius="1" 
  11.      borderColor="#CCCCCC" 
  12.      xmlns:module="module.*">
  13. <mx:Script>  
  14.         <![CDATA[
  15.             import mx.core.IUITextField;
  16.             import mx.core.UITextFormat;
  17.             import mx.controls.LinkButton;
  18.             import mx.controls.Button;
  19.             import mx.controls.TextArea;
  20.             import code.ProductHandlerBasic;
  21.             
  22.             import mx.controls.RichTextEditor;
  23.             import mx.managers.PopUpManager ;
  24.                
  25.             //允许最多输入的文字个数
  26.             public var MAX_LENGTH:Number = 144 ;
  27.             
  28.             private var _phander:ProductHandlerBasic;
  29.             private var _targetLabelName:String ;
  30.             private var _htmlContent:String ;
  31.         
  32.             public function initUI():void {
  33.                 
  34.             }    
  35.             public function set targetLabelName(t:String):void{
  36.                 _targetLabelName = t ;
  37.             }
  38.             public function get targetLabelName():String{
  39.                 return _targetLabelName ;
  40.             }
  41.             public function set phander(p:ProductHandlerBasic):void{
  42.                 this._phander = p ;
  43.             }
  44.             public function get phander():ProductHandlerBasic{
  45.                 return this._phander ;
  46.             }
  47.             
  48.             private function cancleHanlder():void
  49.                 PopUpManager.removePopUp(this); 
  50.             } 
  51.             
  52.              
  53.             /**
  54.              * 应用修改 
  55.              */
  56.             private function applicationHandler():void{    
  57.                 if(this.my_rte.text.length>MAX_LENGTH){ 
  58.                     lenid.text="最多只能输入"+MAX_LENGTH+"个字";
  59.                     return ;  
  60.                 }      
  61.                 this._phander.saveUserInputText(my_rte.htmlText,my_rte.text,_targetLabelName);
  62.                 this.cancleHanlder() ;
  63.             }
  64.             
  65.             /**
  66.              * 改变字体颜色
  67.              */ 
  68.             private function changeColor(e:Event):void{
  69.                 var b_:LinkButton = LinkButton(e.target);
  70.                 //从新编辑文字时,如果文本没有被改变,将得不到焦点.所以调用次来改变焦点
  71.                 my_rte.text = my_rte.text+""
  72.                 my_rte.setStyle("color",b_.getStyle("color")); 
  73.             } 
  74.         ]]> 
  75. </mx:Script>      
  76.      
  77.      <!--
  78.     <mx:RichTextEditor  id="my_rte"  x="86" y="56" width="388" height="250">
  79.     </mx:RichTextEditor>  
  80.     --> 
  81.     <mx:TextArea id="my_rte" verticalScrollPolicy="off"  horizontalScrollPolicy="off" maxChars="{this.MAX_LENGTH}" fontSize="12" x="10" y="36" width="240" height="170">
  82.         
  83.     </mx:TextArea>
  84.     
  85.     <!--
  86.     
  87.     <module:RichTexlql id="my_rte" verticalScrollPolicy="off" x="6" y="11" height="323" width="468"    backgroundAlpha="1" fontSize="12" borderStyle="solid" alpha="1.0" borderThickness="2">
  88.          
  89.     </module:RichTexlql> 
  90.     -->
  91.      
  92.     
  93.     <mx:Button x="290" y="235" label="取消" click="cancleHanlder()" fontSize="12" fontWeight="bold" cornerRadius="10" borderColor="#81050D" fillAlphas="[1.0, 1.0]" fillColors="[#81050D, #81050D]" color="#FFFFFF"/>
  94.     <mx:Label id="lenid" x="11" y="7" text="您还可以已输入 {this.MAX_LENGTH-my_rte.text.length} 个字" width="160" height="23" fontSize="12" color="#000000" fontWeight="normal"/>
  95.     <mx:Button x="361" y="235" label="应用" click="applicationHandler()" fontSize="12" fontWeight="bold" cornerRadius="10" borderColor="#81050D" fillAlphas="[1.0, 1.0]" fillColors="[#81050D, #81050D]" color="#FFFFFF"/>
  96.     <mx:LinkButton x="361" y="88" label="橙色" fontSize="12" click="changeColor(event);" fontWeight="normal" textDecoration="underline" color="#FF6600"/>
  97.     
  98.     <mx:LinkButton x="307" y="88" label="褐色" fontSize="12" click="changeColor(event);" fontWeight="normal" textDecoration="underline" color="#099330"/>
  99.     
  100.     <mx:LinkButton x="251" y="88" label="黑色" fontSize="12" click="changeColor(event);" fontWeight="normal" textDecoration="underline" color="#000000"/>
  101.     
  102.     <mx:LinkButton x="251" y="152" label="天蓝色" fontSize="12" click="changeColor(event);" fontWeight="normal" textDecoration="underline" color="#00CCFF"/>
  103.     <mx:LinkButton x="307" y="152" label="水绿色" fontSize="12" click="changeColor(event);" fontWeight="normal" textDecoration="underline" color="#33CCCC"/>
  104.     <mx:LinkButton x="361" y="152" label="蓝灰色" fontSize="12" click="changeColor(event);" fontWeight="normal" textDecoration="underline" color="#666699"/>
  105.     <mx:LinkButton x="251" y="120" label="绿色" fontSize="12" click="changeColor(event);" fontWeight="normal" textDecoration="underline" color="#008000"/>
  106.     <mx:LinkButton x="307" y="120" label="海绿色" fontSize="12" click="changeColor(event);" fontWeight="normal" textDecoration="underline" color="#339966"/>
  107.     <mx:LinkButton x="361" y="120" label="橄榄色" fontSize="12" click="changeColor(event);" fontWeight="normal" textDecoration="underline" color="#333300"/>
  108.     <mx:Label x="263" y="47" text="请选择文字颜色:" fontSize="12" fontWeight="normal"/>
  109.     
  110.        
  111. </mx:Canvas>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值