RE: [Flashcoders] WSIWYG HTML text editor in Flash - follow on question
have you tried using the unescape function?.something like this: test_txt.replaceSel(unescape(img src=\mountains.jpg\ width=\350\ height=\120\ /)); That doesn't seem to work. Still shows as: lt;img src=quot;mountains.jpgquot; width=quot;350quot; height=quot;120quot; /gt; Thanks though. Jason Merrill Bank of America Learning Organization Effectiveness - Technology Solutions -Original Message- From: [EMAIL PROTECTED] [mailto:flashcoders- [EMAIL PROTECTED] On Behalf Of John VanHorn Sent: Monday, August 07, 2006 8:43 PM To: Flashcoders mailing list Subject: Re: [Flashcoders] WSIWYG HTML text editor in Flash - follow on question On 8/7/06, Merrill, Jason [EMAIL PROTECTED] wrote: Oh, and to follow up with some further information: It seems to only encode those HTML entities when I use TextField.replaceSel(). If I just add the img tag string on to the htmltext field value, it works: //works: test_txt.htmlText += img src=\mountains.jpg\ width=\350\ height=\120\ /; //fails - shows literal text, and encodes entities: test_txt.replaceSel(img src=\mountains.jpg\ width=\350\ height=\120\ /); Am I left with splitting the string in two, inserting the img tag, and re-assembling the string? Or is there a way to get replaceSel() to work with HTML tags? Thanks, Jason Merrill Bank of America Learning Organization Effectiveness - Technology Solutions ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] WSIWYG HTML text editor in Flash - follow on question
http://mirror1.cvsdude.com/trac/osflash/red5/browser/java/server/trunk/swf/DEV_Source/classes/com/blitzagency/data/DecodeHTML.as This is what I use for that Jason, hope that helps JG On 8/8/06, Merrill, Jason [EMAIL PROTECTED] wrote: have you tried using the unescape function?.something like this: test_txt.replaceSel(unescape(img src=\mountains.jpg\ width=\350\ height=\120\ /)); That doesn't seem to work. Still shows as: lt;img src=quot;mountains.jpgquot; width=quot;350quot; height=quot;120quot; /gt; Thanks though. Jason Merrill Bank of America Learning Organization Effectiveness - Technology Solutions -Original Message- From: [EMAIL PROTECTED] [mailto:flashcoders- [EMAIL PROTECTED] On Behalf Of John VanHorn Sent: Monday, August 07, 2006 8:43 PM To: Flashcoders mailing list Subject: Re: [Flashcoders] WSIWYG HTML text editor in Flash - follow on question On 8/7/06, Merrill, Jason [EMAIL PROTECTED] wrote: Oh, and to follow up with some further information: It seems to only encode those HTML entities when I use TextField.replaceSel(). If I just add the img tag string on to the htmltext field value, it works: //works: test_txt.htmlText += img src=\mountains.jpg\ width=\350\ height=\120\ /; //fails - shows literal text, and encodes entities: test_txt.replaceSel(img src=\mountains.jpg\ width=\350\ height=\120\ /); Am I left with splitting the string in two, inserting the img tag, and re-assembling the string? Or is there a way to get replaceSel() to work with HTML tags? Thanks, Jason Merrill Bank of America Learning Organization Effectiveness - Technology Solutions ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com -- [ JPG ] ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
RE: [Flashcoders] WSIWYG HTML text editor in Flash - follow on question
John, Thanks - yes, that class works, thanks for the link. But unfortunately, it appears it is the Textfield.replaceSel() function which encodes it upon display - so I would have to then parse through the textfield and find the encoded string, then decode it using that class, and put it back in the textfield - what a hassle! Is there another method to insert HTML tags into a textField besides replaceSel() which won't encode it? At this point, especially since I need to be able to allow the user to remove the tag as well, I think I'm just better off keeping the image separate from the HTML in a movieClip. Would seem to be much easier and less bug-prone. Thanks for the link though, I'm sure I can use than class in the future. I added it to my package library. Jason Merrill Bank of America Learning Organization Effectiveness - Technology Solutions -Original Message- From: [EMAIL PROTECTED] [mailto:flashcoders- [EMAIL PROTECTED] On Behalf Of John Grden Sent: Tuesday, August 08, 2006 3:35 PM To: Flashcoders mailing list Subject: Re: [Flashcoders] WSIWYG HTML text editor in Flash - follow on question http://mirror1.cvsdude.com/trac/osflash/red5/browser/java/server/trunk /swf/ DEV_Source/classes/com/blitzagency/data/DecodeHTML.as This is what I use for that Jason, hope that helps JG ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] WSIWYG HTML text editor in Flash - follow on question
yeah I'm afraid I've not been following along closely enough, not sure what replaceSel() does or how it does it, but sounds like you're on top of it ;) let me know how it finaly works out, JG On 8/8/06, Merrill, Jason [EMAIL PROTECTED] wrote: John, Thanks - yes, that class works, thanks for the link. But unfortunately, it appears it is the Textfield.replaceSel() function which encodes it upon display - so I would have to then parse through the textfield and find the encoded string, then decode it using that class, and put it back in the textfield - what a hassle! Is there another method to insert HTML tags into a textField besides replaceSel() which won't encode it? At this point, especially since I need to be able to allow the user to remove the tag as well, I think I'm just better off keeping the image separate from the HTML in a movieClip. Would seem to be much easier and less bug-prone. Thanks for the link though, I'm sure I can use than class in the future. I added it to my package library. Jason Merrill Bank of America Learning Organization Effectiveness - Technology Solutions -Original Message- From: [EMAIL PROTECTED] [mailto:flashcoders- [EMAIL PROTECTED] On Behalf Of John Grden Sent: Tuesday, August 08, 2006 3:35 PM To: Flashcoders mailing list Subject: Re: [Flashcoders] WSIWYG HTML text editor in Flash - follow on question http://mirror1.cvsdude.com/trac/osflash/red5/browser/java/server/trunk /swf/ DEV_Source/classes/com/blitzagency/data/DecodeHTML.as This is what I use for that Jason, hope that helps JG ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com -- [ JPG ] ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
[Flashcoders] WSIWYG HTML text editor in Flash - follow on question
Getting back to this question I had back on Aug 1, thanks for the ideas. I've built a basic HTML text editor in Flash using the TextFormat class. Since I need to save the resulting HTML string back to a database, it works great. However, now I need to insert images into the HTML - which isn't supported by the TextFormat class. So I was thinking I could just insert an img tag string into the textField using TextField.replaceSel(), like this: test_txt.replaceSel(img src=\mountains.jpg\ width=\350\ height=\120\ /); So that part works fine, but when I re-render the textField, the image does not show (doesn't render as HTML), it shows the literal img scr=...etc. characters in the textField (even though it is an HTML textfield). I thought maybe I needed to re-render the textfield, so I left the frame and then jumped back to it, and it still shows the literal HTML. So in testing the value of the html TextField, I found the and \ characters I inserted have been changed to encoded entities in the HTML string: lt;img src=quot;mountains.jpgquot; width=quot;350quot; height=quot;120quot; /gt; Why is that and how can I fix this? It would be pretty messy to use the XML object to decode those entities - why are they getting rendered that way in the first place? Thanks, Jason Merrill Bank of America Learning Organization Effectiveness - Technology Solutions -Original Message- From: [EMAIL PROTECTED] [mailto:flashcoders- [EMAIL PROTECTED] On Behalf Of James Booth Sent: Tuesday, August 01, 2006 10:43 AM To: 'Flashcoders mailing list' Subject: RE: [Flashcoders] WSIWYG HTML text editor in Flash? I just did exactly this, a couple of days ago. I created a class that can apply any kind of supported HTML formatting. The idea seemed daunting at first, but the class is relatively small. You can assign/remove textfields that it should watch. I don't have it here with me right now, but here's the basics: It doesn't use replaceText at all. I have a switch statement for the various textformat options (some are Boolean (bold, italic, etc) and some have arguments (leading, size, etc). When the textfield has focus use an interval to get the beginIndex and endIndex. You can clear the interval onkillFocus. Then in your setFormat function Public function setFormat (type, arg):Void { var temp_fmt:TextFormat = currentField.getTextFormat(beginIndex, endIndex); switch (type) { case bold: case italic: case underline: //etc... { temp_fmt[type] = temp_fmt[type] == false ? true : false; break; } case leading: case align: case size: //etc... { temp_fmt[type] = arg; break; } } currentField.setTextFormat(beginIndex, endIndex, temp_fmt); } This should give you a head start. - James -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Merrill, Jason Sent: Tuesday, August 01, 2006 10:11 AM To: Flashcoders mailing list Subject: [Flashcoders] WSIWYG HTML text editor in Flash? Two related questions. In a nutshell, trying to make a WSIWYG HTML text editor for Flash 7. Question 1: Has anyone created an HTML text editor component or class of some kind in Flash? Basically, having a textfield containing a paragraph of text the user can apply bold, size, font, etc. to - I assume it would use something like: textfield.replaceText(Selection.getBeginIndex(),Selection.getEndIndex( ), theNewString) or something to that effect. So to my second question, I was able to get the above working, but the html Textfield would not apply the new HTML tags, it would show them literally when replaceText was used. Initially, I set the text with textField.htmlText = myText and renders fine with the bolding, but textField.replaceText() seems to not allow the textfield to show the bold tags applied - it shows the literal tag. Any ideas? Basically, would like to create a WSIWYG HTML text editor (flash 7), but from what I read in the archives, it's a lot harder than it sounds and maybe not even possible in Flash right now, but I don't want to give up too early. It seems that all the basic methods are available, there are just some quirks to work out with the Textfield class. Thanks, Jason Merrill Bank of America Learning Organization Effectiveness - Technology Solutions ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
RE: [Flashcoders] WSIWYG HTML text editor in Flash - follow on question
Oh, and to follow up with some further information: It seems to only encode those HTML entities when I use TextField.replaceSel(). If I just add the img tag string on to the htmltext field value, it works: //works: test_txt.htmlText += img src=\mountains.jpg\ width=\350\ height=\120\ /; //fails - shows literal text, and encodes entities: test_txt.replaceSel(img src=\mountains.jpg\ width=\350\ height=\120\ /); Am I left with splitting the string in two, inserting the img tag, and re-assembling the string? Or is there a way to get replaceSel() to work with HTML tags? Thanks, Jason Merrill Bank of America Learning Organization Effectiveness - Technology Solutions -Original Message- From: [EMAIL PROTECTED] [mailto:flashcoders- [EMAIL PROTECTED] On Behalf Of Merrill, Jason Sent: Monday, August 07, 2006 5:55 PM To: Flashcoders mailing list Subject: [Flashcoders] WSIWYG HTML text editor in Flash - follow on question Getting back to this question I had back on Aug 1, thanks for the ideas. I've built a basic HTML text editor in Flash using the TextFormat class. Since I need to save the resulting HTML string back to a database, it works great. However, now I need to insert images into the HTML - which isn't supported by the TextFormat class. So I was thinking I could just insert an img tag string into the textField using TextField.replaceSel(), like this: test_txt.replaceSel(img src=\mountains.jpg\ width=\350\ height=\120\ /); So that part works fine, but when I re-render the textField, the image does not show (doesn't render as HTML), it shows the literal img scr=...etc. characters in the textField (even though it is an HTML textfield). I thought maybe I needed to re-render the textfield, so I left the frame and then jumped back to it, and it still shows the literal HTML. So in testing the value of the html TextField, I found the and \ characters I inserted have been changed to encoded entities in the HTML string: lt;img src=quot;mountains.jpgquot; width=quot;350quot; height=quot;120quot; /gt; Why is that and how can I fix this? It would be pretty messy to use the XML object to decode those entities - why are they getting rendered that way in the first place? Thanks, Jason Merrill Bank of America Learning Organization Effectiveness - Technology Solutions -Original Message- From: [EMAIL PROTECTED] [mailto:flashcoders- [EMAIL PROTECTED] On Behalf Of James Booth Sent: Tuesday, August 01, 2006 10:43 AM To: 'Flashcoders mailing list' Subject: RE: [Flashcoders] WSIWYG HTML text editor in Flash? I just did exactly this, a couple of days ago. I created a class that can apply any kind of supported HTML formatting. The idea seemed daunting at first, but the class is relatively small. You can assign/remove textfields that it should watch. I don't have it here with me right now, but here's the basics: It doesn't use replaceText at all. I have a switch statement for the various textformat options (some are Boolean (bold, italic, etc) and some have arguments (leading, size, etc). When the textfield has focus use an interval to get the beginIndex and endIndex. You can clear the interval onkillFocus. Then in your setFormat function Public function setFormat (type, arg):Void { var temp_fmt:TextFormat = currentField.getTextFormat(beginIndex, endIndex); switch (type) { case bold: case italic: case underline: //etc... { temp_fmt[type] = temp_fmt[type] == false ? true : false; break; } case leading: case align: case size: //etc... { temp_fmt[type] = arg; break; } } currentField.setTextFormat(beginIndex, endIndex, temp_fmt); } This should give you a head start. - James -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Merrill, Jason Sent: Tuesday, August 01, 2006 10:11 AM To: Flashcoders mailing list Subject: [Flashcoders] WSIWYG HTML text editor in Flash? Two related questions. In a nutshell, trying to make a WSIWYG HTML text editor for Flash 7. Question 1: Has anyone created an HTML text editor component or class of some kind in Flash? Basically, having a textfield containing a paragraph of text the user can apply bold, size, font, etc. to - I assume it would use something like: textfield.replaceText(Selection.getBeginIndex(),Selection.getEndInde x( ), theNewString) or something to that effect. So to my second question, I was able to get the above working, but the html Textfield would not apply the new HTML tags, it would show them literally when replaceText was used. Initially, I set the text with textField.htmlText = myText and renders fine with the bolding, but textField.replaceText() seems to not allow the textfield to show the bold tags applied - it shows the literal
Re: [Flashcoders] WSIWYG HTML text editor in Flash - follow on question
have you tried using the unescape function?.something like this: test_txt.replaceSel(unescape(img src=\mountains.jpg\ width=\350\ height=\120\ /)); On 8/7/06, Merrill, Jason [EMAIL PROTECTED] wrote: Oh, and to follow up with some further information: It seems to only encode those HTML entities when I use TextField.replaceSel(). If I just add the img tag string on to the htmltext field value, it works: //works: test_txt.htmlText += img src=\mountains.jpg\ width=\350\ height=\120\ /; //fails - shows literal text, and encodes entities: test_txt.replaceSel(img src=\mountains.jpg\ width=\350\ height=\120\ /); Am I left with splitting the string in two, inserting the img tag, and re-assembling the string? Or is there a way to get replaceSel() to work with HTML tags? Thanks, Jason Merrill Bank of America Learning Organization Effectiveness - Technology Solutions ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com