Форум Flasher.ru

Форум Flasher.ru (http://www.flasher.ru/forum/index.php)
-   ActionScript 1.0/2.0 (http://www.flasher.ru/forum/forumdisplay.php?f=93)
-   -   не читает <br> (http://www.flasher.ru/forum/showthread.php?t=71008)

hamstress 26.10.2005 18:49

не читает <br>
 
флеш читает ХТМЛ теги типа <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)



Часовой пояс GMT +4, время: 02:55.

Copyright © 1999-2008 Flasher.ru. All rights reserved.
Работает на vBulletin®. Copyright ©2000 - 2026, Jelsoft Enterprises Ltd. Перевод: zCarot
Администрация сайта не несёт ответственности за любую предоставленную посетителями информацию. Подробнее см. Правила.