如何“追加” Flex和Flex移动项目中的html文本到文本区域以显示精灵和文本格式
我正在使用消息类型的应用程序。有谁知道如何将 html 文本“附加”到 Flex 和 Flex 移动项目中的文本区域,或者有任何教程吗?具体来说,我如何在需要时将其内嵌到文本中“附加”精灵?一些简单的东西,比如:
用户名:这里有一些文字!
那么,有人有“附加”精灵或简单文本格式的经验吗?谢谢,我真的很困惑如何解决这些问题!
编辑: 根据下面的答案,有人建议它很简单......
textAreaInstance.htmlText += "<b>Username:</b> some text right here!";
但事实并非如此。您不能对文本区域执行 .htmltext
。你可以在文本字段上,所以我尝试了
var TF:TextField = new TextField();
TF.width = 200;
TF.height = 200;
TF.htmlText="Image in textfield: <img src='http://upload.pusha.se/3/HittaTidning_75.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;
所有这些显示的是 [object TextField]
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:
Username: some text right here!
So, Anyone have any experience "appending" sprites or simple text formatting? Thanks I'm realy stumped on how to solve these issues!
EDIT:
Based on an answer below it was sugguested that it's as simple as...
textAreaInstance.htmlText += "<b>Username:</b> some text right here!";
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='http://upload.pusha.se/3/HittaTidning_75.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;
All this displays is [object TextField]
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您所需要的只是
TextField
的htmlText
属性:查看 此处了解详细信息。
至于嵌入精灵。类似的问题之前被问过。查看动态文本字段中的 Actionscript 问题
All you need is
htmlText
property ofTextField
:look here for details.
As for embing sprite. Similar question was asked before. take a look at Actionscript problem in Dynamic TextField
没有附加 html 文本的方法,因此您必须使用 += 附加 html 格式的内容:
您可以通过这种方式在 TextArea 中嵌入显示对象:
我不知道如何将显示对象嵌入到 Spark TextArea 中。
干杯
There is no method to append html text, so you have to use += appending your html formatted stuff:
You can embed display objects in TextArea in this way:
I don't know any way embedding display objects into spark TextArea.
Cheers
对于移动设备,这有效(为我工作):
检查此链接
http://remotesynthesis.com/post.cfm /adding-html-text-to-a-flex-mobile-textarea
但使用 StyleableTextField 而不是 MobileTextField
For mobile this works (Worked for me):
Check this link
http://remotesynthesis.com/post.cfm/adding-html-text-to-a-flex-mobile-textarea
but use StyleableTextField instead of MobileTextField