繁体   English   中英

flex4 textArea HTML

[英]flex4 textArea HTML

问题是关于Flex4文本引擎的:

我想1)将HTML文本附加到textArea text1

我可以像这样加载文本:

var s:String='<p fontSize="12">TextArea with<span fontWeight="bold">TLF</span> block</p>';
text1.textFlow = TextFlowUtil.importFromString(text1.text + s, TextConverter .TEXT_FIELD_HTML_FORMAT);

但是我不知道该如何添加新文字!

2)将图像添加到textArea

新的TLF中的所有这些:有什么想法吗?

问候

这将设置文本并加载图像,然后使用计时器每5秒添加一次文本:

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
               xmlns:s="library://ns.adobe.com/flex/spark"
               xmlns:mx="library://ns.adobe.com/flex/mx"
               minWidth="955"
               minHeight="600"
               creationComplete="creationCompleteHandler(event)">

    <fx:Script>
        <![CDATA[
            import flashx.textLayout.conversion.TextConverter;
            import flashx.textLayout.elements.TextFlow;

            import mx.events.FlexEvent;

            [Bindable]
            private var text:String =
                "This text can be appended to.<br />" +
                "<br />" +
                "<img src=\"http://www.google.com/intl/en_com/images/srpr/logo3w.png\" />";


            private var timer:Timer;

            protected function creationCompleteHandler(event:FlexEvent):void
            {
                // 5-seconds later, append text
                timer = new Timer(5000);
                timer.addEventListener(TimerEvent.TIMER, timerHandler);
                timer.start();
            }

            protected function timerHandler(event:TimerEvent):void
            {
                text += "This is the appended text.<br />";
            }
        ]]>
    </fx:Script>

    <s:RichEditableText editable="false"
                        selectable="true"
                        textFlow="{TextConverter.importToFlow(text, TextConverter.TEXT_FIELD_HTML_FORMAT)}"
                        buttonMode="true"
                        width="100%"
                        height="100%" />

</s:Application>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM