14/01/2008/** By ::[PHOXER]:: http://www.phoxer.com v 1.7; */ package phoxer.FlexForms{ import flash.events.Event; import flash.events.TimerEvent; import flash.utils.Timer; import mx.controls.ProgressBar; import mx.controls.RichTextEditor; import mx.events.FlexEvent; import phoxer.Strings.HtmlClean; public class XRichTextEditor extends RichTextEditor{ public var maxChars:int=0; public var titleStyleName:String; public var fontFamilyComboVisibility:Boolean=true; public var fontSizeComboVisibility:Boolean=true; public var colorPickerVisibility:Boolean=true; public var linkTextInputVisibility:Boolean=true; private var ProgressChars:ProgressBar; private var cheker:Timer= new Timer(500,1); public function XRichTextEditor(){ this.addEventListener(FlexEvent.CREATION_COMPLETE,onCreationComplete,false,0,true); super(); } //PROGRESS CHARS private function setProgressChars():void{ this.textArea.maxChars=maxChars; if(maxChars>0){ ProgressChars= new ProgressBar(); ProgressChars.mode="manual"; ProgressChars.labelPlacement="center"; ProgressChars.label="%1 / %2"; ProgressChars.y=this.textArea.height; ProgressChars.width=this.textArea.width; ProgressChars.height=15; ProgressChars.minimum=0; ProgressChars.maximum=this.textArea.maxChars; this.textArea.addEventListener(Event.CHANGE,onTextChange,false,0,true); this.addChild(ProgressChars); cheker.addEventListener(TimerEvent.TIMER,onTextChange,false,0,true); } } private function onTextChange(e:Event):void{ if(ProgressChars){ ProgressChars.label="%1 / %2 | (%3%%)"; ProgressChars.setProgress(this.textArea.length,this.textArea.maxChars); if (ProgressChars.percentComplete > 90) { ProgressChars.setStyle("themeColor", "red"); } else if (ProgressChars.percentComplete > 80) { ProgressChars.setStyle("themeColor", "yellow"); } else { ProgressChars.setStyle("themeColor", "haloGreen"); } } } public function getCleanHTML(fnt:Boolean=false):String{ return HtmlClean.cleanHtml(this.htmlText); } public function onTextDataChange():void{ cheker.start(); } //CREATION COMPLETE private function onCreationComplete(e:FlexEvent):void{ this.removeEventListener(FlexEvent.CREATION_COMPLETE,onCreationComplete); if(titleStyleName){ this.titleBar.styleName=titleStyleName; } setProgressChars(); setVisibilities(); } public function setVisibilities():void{ this.fontFamilyCombo.visible=fontFamilyComboVisibility; this.fontSizeCombo.visible=fontSizeComboVisibility; this.colorPicker.visible=colorPickerVisibility; this.linkTextInput.visible=linkTextInputVisibility; this._RichTextEditor_VRule1.visible=false; this._RichTextEditor_VRule2.visible=false; } override protected function createChildren():void { super.createChildren(); } override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void{ super.updateDisplayList(unscaledWidth, unscaledHeight); } } }
![]() |
No hay comentarios.----------------------------------------------
Si los tutoriales o los temas tratados en este blog te gustaron y quieres ayudarme a mantenerlos en linea puede hacer una donacion.
La donaciones son destinadas para mantener este blog y a los tutoriales Online.