如何与QUOT;将"在Flex和Flex手机项目的HTML文本的文本区域显示精灵和文本格式文本、区域、精灵、格式

2023-09-08 13:56:01 作者:笙歌君独幽

我玩弄应用程序的消息类型。有谁知道怎么上的追加HTML文本的任何教程,或者在Flex和Flex移动项目的文本区域?而具体如何我可能会采取基本上追加一个精灵内嵌的文字时,我需要?一些简单的像:

I'm playing around with a messaging type of application. Does anyone know how, or of any tutorials on to "appending" html text to text areas in flex and flex mobile projects? And specifically how I could take that and basically "append" a sprite inline to the text when i need to? Something simple like:

用户名:一些文​​字在这里

因此​​,任何人有任何经验的追加精灵或简单的文本格式?谢谢,我真的难倒就如何解决这些问题!

So, Anyone have any experience "appending" sprites or simple text formatting? Thanks I'm realy stumped on how to solve these issues!

编辑: 基于它下面的答案是sugguested,它就是这么简单...

Based on an answer below it was sugguested that it's as simple as...

textAreaInstance.htmlText += "<b>Username:</b> some text right here!";

但它不是。你不能这样做 .htmltext 用文本区域。你可以在一个文本字段,所以我尝试

But its not. you can't do .htmltext with a text area. you can on a text field, so i tried

var TF:TextField = new TextField();
TF.width = 200;
TF.height = 200;
TF.htmlText="Image in textfield: <img src='https://m.xsw88.com/allimgs/daicuo/20230908/908.png.jpg' hspace='0' vspace='0'>";

//then i go to my text area instance and tried to add it the way you suggested                  
text_area_instance.text += TF;

这一切都显示为 [对象文本字段]

推荐答案

有没有方法来添加HTML文本,所以你必须使用+ =追加你的HTML格式的东西:

There is no method to append html text, so you have to use += appending your html formatted stuff:

    textAreaInstance.htmlText += "<b>Username:</b> some text right here!";

您可以嵌入这样的文本区显示对象:

You can embed display objects in TextArea in this way:

    <fx:Script>
    <![CDATA[
        //display object class, what simply draws a recangle
        //you have to create a reference from this class, otherwise it won't work
        private var img:ImageStuff;


        protected function button1_clickHandler(event:MouseEvent):void
        {
            txt.htmlText = "<img src='ImageStuff' width='16' height='16'/>";
        }

    ]]>
</fx:Script>

    <mx:TextArea id="txt"/>
    <s:Button click="button1_clickHandler(event)" />

我不知道任何方式嵌入显示对象为火花文本区。

I don't know any way embedding display objects into spark TextArea.

干杯