This works great. Anyone ever tried to create a html to rtf converter in flex? My final result needs to be in rtf.
________________________________ From: flexcoders@yahoogroups.com on behalf of Christoph Diefenthal Sent: Wed 11/23/2005 7:27 AM To: 'flexcoders@yahoogroups.com' Subject: RE: [flexcoders] RTF Editor Integrated into Flex Check THIS out :) Flex 1.5 - RichText Editor Found it once. I think it was in this group. Works pretty good. Thanks for that. import mx.core.UIComponent; import mx.controls.Button; import mx.controls.TextArea; import mx.controls.ComboBox; import mx.utils.Delegate; //import com.avsa._general.components.editor.*; //import com.avsa._general.components.colorpicker.*; //class com.avsa._general.components.editor.Editor extends UIComponent { class TextEditor extends UIComponent { static var symbolName:String="TextEditor"; static var symbolOwner:Object = TextEditor; var className:String = "TextEditor"; function TextEditor() { } function init():Void { super.init(); invalidate(); } var start:Number; var end:Number; var btBold:Button; var btItalic:Button; var btUnderline:Button; var btLeft:Button; var btCenter:Button; var btRight:Button; var cComboSize:ComboBox; var cComboFont:ComboBox; var cText:TextArea; var cTempField:TextField; var cTempFormat:TextFormat; //var cColor:ColorPicker; //temp var focusListener:Object function createChildren():Void { //======================================================== // Buttons //======================================================== createClassObject(Button, "btBold", 11, {label:"B"}); createClassObject(Button, "btItalic", 12, {label:"I"}); createClassObject(Button, "btUnderline", 13, {label:"U"}); createClassObject(Button, "btLeft", 14, {label:"L"}); createClassObject(Button, "btCenter", 15, {label:"C"}); createClassObject(Button, "btRight", 16, {label:"R"}); btBold.addEventListener("click", this); btItalic.addEventListener("click", this); btUnderline.addEventListener("click", this); btLeft.addEventListener("click", this); btCenter.addEventListener("click", this); btRight.addEventListener("click", this); btBold.move(0,0); btItalic.move(50,0); btUnderline.move(100,0); btLeft.move(0,20); btCenter.move(50,20); btRight.move(100,20); //======================================================== // Combos //======================================================== var aSizes:Array = new Array(8,10,12,14,16,18,20,22,24,26,28,30,32,34); createClassObject(ComboBox, "cComboSize", 21, {dataProvider:aSizes}); var aFont:Array = new Array("Arial","Courier","Times New Roman","Verdana"); createClassObject(ComboBox, "cComboFont", 22, {dataProvider:aFont}); cComboSize.move(-200,0); cComboFont.move(-200,20); cComboSize.addEventListener("change", this); cComboFont.addEventListener("change", this); //======================================================== // TEXT AREA //======================================================== createClassObject(TextArea, "cText", 4, {html: true, id:"cText", editable : false, htmlText : "test test"}); cText.width = 300; cText.height = 150; cText.move(0,50); cText.addEventListener("keyUp", this); cText.addEventListener("mouseUp", this); cText.addEventListener("mouseOut", this); //======================================================== // TEXT FIELDS //======================================================== createTextField("cTempField", 5, 100, 100, 1, 1); cTempField.type = "Input"; cTempField.multiline = true; cTempField.move(0,250); cTempField.border = true; cTempField.html = true; cTempField.text = "Ola"; cTempField.visible= true; //======================================================== // TEXT FORMAT //======================================================== cTempFormat = new TextFormat(); //======================================================== // Color Picker //======================================================== //createClassObject(ColorPicker, "cColor", 10, {}); //cColor.move(150,0); //cColor.addEventListener("change", this); /* focusListener = new Object(); focusListener.onSetFocus = function(oldFocus_txt, newFocus_txt) { //cText.text = "Old = "// + oldFocus_txt._name + "\nNew = " + newFocus_txt._name; //oldFocus_txt.border = false; //newFocus_txt.border = true; //newFocus_txt.text = "id = " + oldFocus_txt._parent.id; if(newFocus_txt._parent.id == "cText") { Selection.setSelection(start,end); } }; Selection.addListener(focusListener); */ } //======================================================== // Handle Events Functions //======================================================== function getIndex() { //if (Selection.getFocus() == "_level0._obj0.cText.label") //{ start = Number(Selection.getBeginIndex()); end = Number(Selection.getEndIndex()); //} //cTempField.text = "Start = " + start + " End = " + end ; //getFormat(); } function setAlign(type:String){ cTempFormat.align = type; } function setBold(){ cTempFormat.bold = (!cTempFormat.bold); } function setItalic(){ cTempFormat.italic = (!cTempFormat.italic); } function setUnderline(){ cTempFormat.underline = (!cTempFormat.underline); } function setTextSize(size:Number){ cTempFormat.size = size; } function setTextFont(font:String){ cTempFormat.font = font; } function setTextColor(color){ cTempFormat.color = color; } function getFormat() { cTempField.htmlText = cText.htmlText; cTempFormat = cTempField.getTextFormat(start,end); } function setFormat() { cTempField.setTextFormat(start,end,cTempFormat); cText.htmlText = cTempField.htmlText; Selection.setFocus(cText); //IntervalId = setInterval(setSelectionAfter,100); Selection.setSelection(start,end); //mx.controls.Alert.show("ok"); //cTempField.text = "Start = " + start + "\nEnd = " + end; //Selection.setSelection(start,end); } /* var IntervalId:Number; function setSelectionAfter() { Selection.setFocus(cText.label); Selection.setSelection(start,end); clearInterval(IntervalId); } */ function handleEvent(evt:Object):Void { utils.log.Logger.getInstance().dev(this," cText.htmlText:" + cText.htmlText ); switch(evt.type) { case "click": { getFormat(); switch(evt.target._name) { case "btBold": setBold(); break; case "btItalic": setItalic(); break; case "btUnderline": setUnderline(); break; case "btLeft": setAlign("left"); break; case "btCenter": setAlign("center"); break; case "btRight": setAlign("right"); break; } setFormat(); break; } case "change": { getFormat(); switch(evt.target._name) { case "cComboSize": setTextSize(evt.target.selectedItem); break; case "cComboFont": setTextFont(evt.target.selectedItem); break; case "cColor": setTextColor(evt.target.selectedColor); break; } setFormat(); break; } default: getIndex(); } //cTempField.text = "Start = " + start + "\nEnd = " + end; } } > -----Ursprüngliche Nachricht----- > Von: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] Im > Auftrag von Aldo Bucchi > Gesendet: Mittwoch, 23. November 2005 07:15 > An: flexcoders@yahoogroups.com > Betreff: Re: [flexcoders] RTF Editor Integrated into Flex > > Flex2 comes with a rich text editor component out of the box. > check it out. > > For flex1.5 though, I have no clue. > > On 11/22/05, someguy7_7 <[EMAIL PROTECTED]> wrote: > > > > I have seen all the messages about the couple different flash rtf > editors that people have created. Has anyone actually integrated one with > flex? If so which one? How is it working? > > > > > > > > > > > > > > > > > > > > -- > > Flexcoders Mailing List > > FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt > > Search Archives: http://www.mail- > archive.com/flexcoders%40yahoogroups.com > > Yahoo! Groups Links > > > > > > > > > > > > > > > > > -- > ::::: Aldo Bucchi ::::: > mobile (56) 8 429 8300 > > > > -- > Flexcoders Mailing List > FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt > Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com > Yahoo! Groups Links > > > > > -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com ________________________________ YAHOO! GROUPS LINKS * Visit your group "flexcoders <http://groups.yahoo.com/group/flexcoders> " on the web. * To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> * Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service <http://docs.yahoo.com/info/terms/> . ________________________________ ------------------------ Yahoo! Groups Sponsor --------------------~--> Get fast access to your favorite Yahoo! Groups. Make Yahoo! your home page http://us.click.yahoo.com/dpRU5A/wUILAA/yQLSAA/nhFolB/TM --------------------------------------------------------------------~-> -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
<<winmail.dat>>