PDA

Просмотр полной версии : не читает <br>


hamstress
26.10.2005, 18:49
флеш читает ХТМЛ теги типа <b>,<i> но не видит <br>.
Как быть?
скрипт стандартный
var my_fmt:TextFormat = new TextFormat();
my_fmt.font = "Arial";
this.createTextField("my_txt", this.getNextHighestDepth(), 10, 10, 500, 500);
my_txt.border = true;
my_txt.html = true;
my_txt.wordWrap = true;
my_txt.embedFonts = true;
my_txt.htmlText = theAuthor;
my_txt.setTextFormat(my_fmt);

EscGP
26.10.2005, 18:58
Это тут не причем. Покажи текст загрузчика текста.

kruasan
26.10.2005, 20:21
Флэш понимает <br> в том случае, если есть и закрывающий тэг </br>.
Есть в твоем тексте </br>?

ravenco
26.10.2005, 20:32
Если ВЫ открываете в TextField тогда ВАМ сюда
Flash 2004MX\Samples\TextEnhancements\TextEnhancements.fla
(Она быстрее и стильнее чем в твоем примере... наверное)

hamstress
26.10.2005, 20:40
Вот скрипт, который читает ХМЛ
myXML = new XML();
myXML.ignoreWhite = true;
myXML.load("menu.xml");
myXML.onLoad = function(success) {
if (success == true) {
rootNode = myXML.firstChild;
autorTag = rootNode.firstChild;
theAuthor = autorTag.firstChild;
widthtag = theAuthor.firstChild;
gotoAndStop(2);
}
};

вот сама строка ХМЛ

<navigation><dimension>Hello<br>Hello again</br></dimension><name>name of smth</name><width>width of smth</width></navigation>



Должна выводить
Hello
Hello again
а выводит в одну строку

7thsky™
26.10.2005, 20:48
есть такое понятие как <![CDATA[тут ваш html text]]>
то есть выглядеть должно типа такого

<navigation>
<dimension>
<![CDATA[Hello <br> Hello again <br>]]>
</dimension>
<name> name of smth </name>
<width>width of smth </width>
</navigation>

iNils
26.10.2005, 20:53
Добавлю
вместо
Hello<br>Hello again</br>
надо
Hello<br/>Hello again

hamstress
26.10.2005, 20:53
И ка обратиться к такой структуре? <![CDATA[Hello <br> Hello again <br>]]>

ведь стандартными приёмами они текст не увидит

hamstress
26.10.2005, 20:54
Вернее видит, но <br> не воспринимает как тег

iNils
26.10.2005, 21:00
theAuthor = autorTag.firstChild.nodeValue;

вот пример
myXML = new XML ("<navigation><dimension><![CDATA[Hello <br> Hello again <br>]]></dimension><name> name of smth </name><width>width of smth </width></navigation>");
myXML.ignoreWhite = true;
rootNode = myXML.firstChild;
autorTag = rootNode.firstChild;
theAuthor = autorTag.firstChild.nodeValue;
var my_fmt = new TextFormat ();
my_fmt.font = "Arial";
my_fmt.color =0xff0000
this.createTextField ("my_txt", 1, 10, 10, 500, 500);
my_txt.setTextFormat (my_fmt);
my_txt.border = true;
my_txt.html = true;
my_txt.wordWrap = true;
//my_txt.embedFonts = true;
my_txt.htmlText = theAuthor;
trace (theAuthor)

Король
26.10.2005, 21:01
можно еще написать &lt;br&gt;

hamstress
26.10.2005, 21:35
Получилось, спасибо, только ещё надо my_txt.multiline = true; добавить.

hamstress
26.10.2005, 21:36
Кстате, когда трейсишь значение, так и показывает вместо скобок 16-ричные значения

Король
26.10.2005, 21:55
какие 16-ричные значения?