- <?xml version="1.0" encoding="utf-8"?>
- <mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml"
- creationComplete="initUI();"
- width="428"
- height="300"
- borderStyle="solid"
- borderThickness="2"
- themeColor="#E9EFF3"
- backgroundColor="#E6E6E6"
- cornerRadius="1"
- borderColor="#CCCCCC"
- xmlns:module="module.*">
- <mx:Script>
- <![CDATA[
- import mx.core.IUITextField;
- import mx.core.UITextFormat;
- import mx.controls.LinkButton;
- import mx.controls.Button;
- import mx.controls.TextArea;
- import code.ProductHandlerBasic;
- import mx.controls.RichTextEditor;
- import mx.managers.PopUpManager ;
- //允许最多输入的文字个数
- public var MAX_LENGTH:Number = 144 ;
- private var _phander:ProductHandlerBasic;
- private var _targetLabelName:String ;
- private var _htmlContent:String ;
- public function initUI():void {
- }
- public function set targetLabelName(t:String):void{
- _targetLabelName = t ;
- }
- public function get targetLabelName():String{
- return _targetLabelName ;
- }
- public function set phander(p:ProductHandlerBasic):void{
- this._phander = p ;
- }
- public function get phander():ProductHandlerBasic{
- return this._phander ;
- }
- private function cancleHanlder():void{
- PopUpManager.removePopUp(this);
- }
- /**
- * 应用修改
- */
- private function applicationHandler():void{
- if(this.my_rte.text.length>MAX_LENGTH){
- lenid.text="最多只能输入"+MAX_LENGTH+"个字";
- return ;
- }
- this._phander.saveUserInputText(my_rte.htmlText,my_rte.text,_targetLabelName);
- this.cancleHanlder() ;
- }
- /**
- * 改变字体颜色
- */
- private function changeColor(e:Event):void{
- var b_:LinkButton = LinkButton(e.target);
- //从新编辑文字时,如果文本没有被改变,将得不到焦点.所以调用次来改变焦点
- my_rte.text = my_rte.text+"";
- my_rte.setStyle("color",b_.getStyle("color"));
- }
- ]]>
- </mx:Script>
- <!--
- <mx:RichTextEditor id="my_rte" x="86" y="56" width="388" height="250">
- </mx:RichTextEditor>
- -->
- <mx:TextArea id="my_rte" verticalScrollPolicy="off" horizontalScrollPolicy="off" maxChars="{this.MAX_LENGTH}" fontSize="12" x="10" y="36" width="240" height="170">
- </mx:TextArea>
- <!--
- <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">
- </module:RichTexlql>
- -->
- <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"/>
- <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"/>
- <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"/>
- <mx:LinkButton x="361" y="88" label="橙色" fontSize="12" click="changeColor(event);" fontWeight="normal" textDecoration="underline" color="#FF6600"/>
- <mx:LinkButton x="307" y="88" label="褐色" fontSize="12" click="changeColor(event);" fontWeight="normal" textDecoration="underline" color="#099330"/>
- <mx:LinkButton x="251" y="88" label="黑色" fontSize="12" click="changeColor(event);" fontWeight="normal" textDecoration="underline" color="#000000"/>
- <mx:LinkButton x="251" y="152" label="天蓝色" fontSize="12" click="changeColor(event);" fontWeight="normal" textDecoration="underline" color="#00CCFF"/>
- <mx:LinkButton x="307" y="152" label="水绿色" fontSize="12" click="changeColor(event);" fontWeight="normal" textDecoration="underline" color="#33CCCC"/>
- <mx:LinkButton x="361" y="152" label="蓝灰色" fontSize="12" click="changeColor(event);" fontWeight="normal" textDecoration="underline" color="#666699"/>
- <mx:LinkButton x="251" y="120" label="绿色" fontSize="12" click="changeColor(event);" fontWeight="normal" textDecoration="underline" color="#008000"/>
- <mx:LinkButton x="307" y="120" label="海绿色" fontSize="12" click="changeColor(event);" fontWeight="normal" textDecoration="underline" color="#339966"/>
- <mx:LinkButton x="361" y="120" label="橄榄色" fontSize="12" click="changeColor(event);" fontWeight="normal" textDecoration="underline" color="#333300"/>
- <mx:Label x="263" y="47" text="请选择文字颜色:" fontSize="12" fontWeight="normal"/>
- </mx:Canvas>
flex开发卡片文字编辑(五)
最新推荐文章于 2024-05-25 04:25:11 发布