[英]flex4 textArea HTML
Question is about Flex4 Text Engine: 问题是关于Flex4文本引擎的:
I want to 1) append HTML text to textArea text1 我想1)将HTML文本附加到textArea text1
I can load text like: 我可以像这样加载文本:
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);
But I have no idea how to appen new text ! 但是我不知道该如何添加新文字!
2) add an image to textArea 2)将图像添加到textArea
All this in the the new TLF : any idea ? 新的TLF中的所有这些:有什么想法吗?
Regards 问候
This sets text plus loads an image, then uses a timer to append text every 5-seconds: 这将设置文本并加载图像,然后使用计时器每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.