AS3 bug? Newline automatically entered after css tag

元气小坏坏 提交于 2020-01-04 06:30:50

问题


I am rendering a TextField (Flash CS5) with the following css and html properties :

css = "a {font-weight: bold;} fu {color: #00A0A0;}"
wordWrap = true
multiline = true
html = <![CDATA[&quot;Phoenicians were pioneering artisans and ingenious craftsmen…

They developed the technique behind the production of transparent glass…

Their innovation spread around the globe throughout the past centuries…

<fu>WE AIM TO CARRY ON WITH THE INNOVATION</fu>&quot;]]>

The last QUOTE is rendered in a line BELOW "WE AIM TO...". It's rendered like this :

...

WE AIM TO CARRY ON WITH THE INNOVATION

"

The ONLY way to render the quote in the same line with "WE AIM..." is to :

a) Either put it INSIDE <fu>

b) Or remove <fu> altogether.

Is this a Flash bug? Am I doing something wrong with css or html?

Many thanks in advance,

Bill


回答1:


The problem here is that htmlText supports only a limited number of tags and attributes, and thus CSS support is frankly quite poor. So it is not a bug, but a known limitation...

My recommendation would be to use a span tag with a class attribute, like:

css = ".foo {color: #00A0A0;}"

html = "&quot;[...]the past centuries…
<span class=\"foo\">WE AIM TO CARRY ON WITH THE INNOVATION</span>&quot;";



回答2:


Instead of going the complex "span" way, just add this in you css description:

css = "a {font-weight: bold;} fu {color: #00A0A0; display:inline;}"



来源:https://stackoverflow.com/questions/6489906/as3-bug-newline-automatically-entered-after-css-tag

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!