风雨AS3 发表于 2019-3-26 09:23:23

RichTextArea,6DN 聊天图文混排类、富文本

本帖最后由 TKCB 于 2019-3-26 09:24 编辑

转载:QQ群
网址:未知
作者:6DN


简介
1. 6DN 聊天图文混排类
2. 可以使用丰富的html标签
3. 可以使用外部jpg以及gif动画 
4. 字符表情,自动转换


demo
attach://2224.swf


更多介绍
/**
*
* 6dn RichTextArea

*----------------------------------------------------------------
* @notice 6dn RichTextArea
* @author 6dn
* @as version1.0
* @date 2010-3-29
*
* AUTHOR ******************************************************************************
*
* authorName : 黎新苑 - www.6dn.cn
* QQ :160379558(6dnの星)
* MSN :xdngo@hotmail.com
* email :6dn@6dn.cn, xdngo@163.com
* webpage : http://www.6dn.cn
*
* LICENSE ******************************************************************************
*
* ① RichTextArea类基于FP9,as3.0的轻量级富文本类!(聊天类型,只支持单行图文混排);
* ② 支持外部图片,可使用jpg,png静态图片,也可以使用gif动态图片,当然,也可以使用有linkage库链接的MovieClip;
* ③ 轻量级,使用简便,使用xml配置,通用的字符表情,输入后马上显示;
* ④ 可使用htmlText,可扩展加入超链接,文字粗细,下划线等textFormat(注:由于styleSheet 和 textFormat冲突,所以这里不能使用styleSheet);
* ⑤ 通过richText属性set 和 get,方便易用;(richText值取到的字符串被Player自动加入了一些html标签,但不影响正常使用);
* ⑥ 此类作为开源使用,但请重视作者劳动成果,请使用此类的朋友保留作者信息。
* Please, keep this header and the list of all authors
*
* ******************************************************************************
*   构造方法:
                RichTextArea($w:int, $h:int) //创建一个宽为$w,高为$h的RichTextArea

        公共方法:
                -appendRichText($str:Stirng):void   //追加$str到RichTextArea;
                -insertRichText($str:String, $beginIndex:int=-1, $endIndex:int = -1):void    //在$beginIndex和$endIndex之间插入字符,默认位置为文本caretIndex即,当前光标位置
                -clear():void                         //清空RichTextArea并回到初始状态
                -resizeTo($w:int, $h:int):void          //重新设定RichTextArea的width,height
                -autoAdjust():void                                  //当外部动态设定了textField的x,y或width,height, 可以使用该方法自动校正使RichTextArea显示正常


        公共属性:
                -textField:TextField   //取得RichTextArea中的文本对象
                -richText:String   //设置和读取富文本的值
                -configXML:XML   //富文本对应的XML配置,请参照示例中的格式
                        //iconUrl:String 可以是外部链接,也可以是有linkage的库链接
                        //iconType:String 三种格式对应
                        //iconStr:String 配置替换的字符串
                       
                -defaultTextFormat:TextFormat //设置和读取富文本的defaultTextFormat; (当RichTextArea已经ADDED_TO_STAGE在舞台显示列表中时,如要动态改变textField的defaultTextFormat请用该属性)

        用法示例 usage:
                var _richTextArea:RichTextArea = new RichTextArea(550,400);
                _richTextArea.configXML = <root>
                                                                        <icon iconUrl='myMC' iconType ="movieClip" iconStr=":]"/>
                                                                        <icon iconUrl='img/1.jpg' iconType ="jpg" iconStr=":o"/>
                                                                        <icon iconUrl='img/2.gif' iconType ="jpg" iconStr=":)"/>
                                                                </root>;
                _richTextArea.x = 0;
                _richTextArea.y = 0;
                _richTextArea.textField.wordWrap=true;
                _richTextArea.textField.multiline=true;
                _richTextArea.textField.border = true;
                _richTextArea.textField.type = TextFieldType.INPUT;
               
                _richTextArea.richText = "Hi!:] welcome to <b><font color='#0033FF' size='13'><a href=\"http://www.6dn.cn/blog\" >6DN Blog</a></font></b>! :) ";
               
                addChild(_richTextArea);
               
                trace(_richTextArea.richText);

*
*
*/


下载

TKCB 发表于 2019-3-26 09:25:54

【11RIA 闪客社区,评分公示】:
是否有价值:优秀(银子 +30贡献 +3)
是否原创:否
是否翻译:否
如对自己的评分有疑问,则咨询版主、管理员等。

雪原xy 发表于 2019-3-26 12:14:46

收藏起来!!!!

Kona 发表于 2020-8-6 17:12:40


收藏起来!!!!
页: [1]
查看完整版本: RichTextArea,6DN 聊天图文混排类、富文本

感谢所有支持论坛的朋友:下面展示最新的5位赞助和充值的朋友……更多赞助和充值朋友的信息,请查看:永远的感谢名单

SGlW(66139)、 anghuo(841)、 whdsyes(255)、 longxia(60904)、 囫囵吞澡(58054)

下面展示总排行榜的前3名(T1-T3)和今年排行榜的前3名的朋友(C1-C3)……更多信息,请查看:总排行榜今年排行榜

T1. fhqu1462(969)、 T2. lwlpluto(14232)、 T3. 1367926921(962)  |  C1. anghuo(147)、 C2. fdisker(27945)、 C3. 囫囵吞澡(58054)