![]() |
|
||||||||||
|
|||||||
|
|
« Предыдущая тема | Следующая тема » |
| Опции темы | Опции просмотра |
|
![]() |
![]() |
|
|||||
|
Регистрация: Aug 2008
Сообщений: 24
|
добрый день!
Подскажите пожалуста, как работая с вот таким XML: − <datapacket> <row pID="1" Business="Business1" Address="Address 1" Telephone="12345" Website="http://www.b1.com" Email="email1@something.com" Details="some text for Details." Picture="image1.jpg"/> <row pID="2" Business="Business2" Address="Address 2" Telephone="67879" Website="http://www.b2.com" Email="email2@something.com" Details="some more text for Details." Picture="image2.jpg"/> <row pID="3" Business="Business3" Address="Address 3" Telephone="010203" Website="http://www.b2.com" Email="email3@something.com" Details="and some more text for Details." Picture="image3.jpg"/> </datapacket> Какую логистику и инструментарий для этого лутше использовать? Разбирался как обрабатывать XML согласно вот этого мануала. http://www.adobe.com/devnet/flash/ar...php_print.html Зарание прошу извенить за скорее всего глупый вопрос новичка ))) |
|
|||||
|
Нуб нубам
модератор форума
Регистрация: Jan 2006
Адрес: Бердск, НСО
Сообщений: 6,445
|
Так и не понял, что именно у Вас не получилось. Покажите Ваш код.
__________________
Reality.getBounds(this); |
|
|||||
|
Регистрация: Aug 2008
Сообщений: 24
|
ну у меня пока что не то чтобы не получилось ) Я просто хочу вокруг монитора и незнаю с какого боку подойти к решению такой задачи и какой инструментарий стоит для этого использовать.
|
|
|||||
|
Регистрация: Aug 2008
Сообщений: 24
|
Перерывши форумы пришол к такому:
В данный момент я работаю с таким кодом: Stage.align = "LT";
Stage.scaleMode = "noScale";
embedFonts = true;
headlineXML = new XML();
headlineXML.onLoad = myLoad;
headlineXML.load("headlines.xml");
function myLoad(ok) {
if (ok == true) {
Publish(this.firstChild);
}
}
function Publish(HeadlineXMLNode) {
if (HeadlineXMLNode.nodeName.toUpperCase() == "BROADCAST") {
content = "<b>List:</b><br><br>";
story = HeadlineXMLNode.firstChild;
while (story != null) {
if (story.nodeName.toUpperCase() == "STORY") {
lead = "";
body = "";
URL = "";
element = story.firstChild;
while (element != null) {
if (element.nodeName.toUpperCase() == "LEAD") {
lead = element.firstChild.nodeValue;
}
if (element.nodeName.toUpperCase() == "BODY") {
body = element.firstChild.nodeValue;
}
if (element.nodeName.toUpperCase() == "URL") {
URL = element.firstChild.nodeValue;
}
element = element.nextSibling;
}
content += "<a href='"+URL+"'>"+lead+"</a><br>"+body+"<br><br>";
createTextField("dynamic_txt", 10, 0, 0, 150, 30);
dynamic_txt.border = true;
dynamic_txt.html = true;
dynamic_txt.autoSize = true;
dynamic_txt.htmlText=content;
}
story = story.nextSibling;
}
}
}
<broadcast> <story> <lead>This is Headline 1</lead> <body>This is where you can add content that will appear under the first headline</body> <URL>http://www.communitymx.com/</URL> </story> <story> <lead>This is Headline 2</lead> <body>This is content that can appear under the second headline.</body> <URL>http://www.flash-remoting.com/</URL> </story> </broadcast> Надеюсь я движусь в правильном русле Последний раз редактировалось jakim_denis; 02.08.2008 в 21:56. |
|
|||||
|
Нуб нубам
модератор форума
Регистрация: Jan 2006
Адрес: Бердск, НСО
Сообщений: 6,445
|
Уже лучше)
У Вас получается один текстфилд, потому что Вы создаете его (думаете что их) на одной глубине. А на одной глубине может быть только один объект. Значит надо ввести счетчик нодов и использовать его значение для управления глубиной и заодно координатой по горизонтали. Перед циклом while вставим объявление переменной - нашего счетчика А в теле цикла, при создании текстфилда, воспользуемся им
__________________
Reality.getBounds(this); |
|
|||||
|
Регистрация: Aug 2008
Сообщений: 24
|
Я логистику решение задачи понял.
Спасибо огромное! Еще маленький вопрос: Подскажите, а какой синтаксис правильно использовать для чтоб дать им имена dynamic1_txt ....... dynamicX_txt ? |
|
|||||
|
Нуб нубам
модератор форума
Регистрация: Jan 2006
Адрес: Бердск, НСО
Сообщений: 6,445
|
Ну например так
var _txt:TextField = this["dynamic"+counter+"_txt"]; _txt.html = _txt.autoSize = true; _txt.htmlText=content;
__________________
Reality.getBounds(this); Последний раз редактировалось Wolsh; 03.08.2008 в 17:48. |
|
|||||
|
Регистрация: Aug 2008
Сообщений: 24
|
я пробовал - но что-то кажись тогда не так с скриптом в целом (
Код: Stage.align = "LT";
Stage.scaleMode = "noScale";
embedFonts = true;
headlineXML = new XML();
headlineXML.onLoad = myLoad;
headlineXML.load("headlines.xml");
function myLoad(ok) {
if (ok == true) {
Publish(this.firstChild);
}
}
function Publish(HeadlineXMLNode) {
if (HeadlineXMLNode.nodeName.toUpperCase() == "BROADCAST") {
content = "";
story = HeadlineXMLNode.firstChild;
while (story != null) {
if (story.nodeName.toUpperCase() == "STORY") {
lead = "";
body = "";
URL = "";
element = story.firstChild;
var counter:Number = 0;
while (element != null) {
if (element.nodeName.toUpperCase() == "LEAD") {
lead = element.firstChild.nodeValue;
}
if (element.nodeName.toUpperCase() == "BODY") {
body = element.firstChild.nodeValue;
}
if (element.nodeName.toUpperCase() == "URL") {
URL = element.firstChild.nodeValue;
}
element = element.nextSibling;
}
content += "<a href='"+URL+"'>"+lead+"</a><br>"+body+"<br><br>";
createTextField("dynamic"+counter+"_txt", 10+counter, counter*150, 0, 150, 30);
var _txt:TextField = this["dynamic"+counter+"_txt"];
_txt.html = true;
_txt.border = true;
_txt.autoSize = true;
_txt.htmlText=content;
counter+=1;
}
story = story.nextSibling;
}
}
}
|
|
|||||
|
Нуб нубам
модератор форума
Регистрация: Jan 2006
Адрес: Бердск, НСО
Сообщений: 6,445
|
ПЕРЕД while а не внутри
в конце while, т.е. перед Счетчи считает стори, а у Вас - почемуто считает ноды внутри стори)))
__________________
Reality.getBounds(this); Последний раз редактировалось Wolsh; 03.08.2008 в 18:21. |
|
|||||
|
Регистрация: Aug 2008
Сообщений: 24
|
Перепутад wile =)))
Поправил, но толку было 0 ((( Stage.align = "LT";
Stage.scaleMode = "noScale";
embedFonts = true;
headlineXML = new XML();
headlineXML.onLoad = myLoad;
headlineXML.load("headlines.xml");
function myLoad(ok) {
if (ok == true) {
Publish(this.firstChild);
}
}
function Publish(HeadlineXMLNode) {
if (HeadlineXMLNode.nodeName.toUpperCase() == "BROADCAST") {
content = "";
story = HeadlineXMLNode.firstChild;
var counter:Number = 0;
while (story != null) {
if (story.nodeName.toUpperCase() == "STORY") {
lead = "";
body = "";
URL = "";
element = story.firstChild;
while (element != null) {
if (element.nodeName.toUpperCase() == "LEAD") {
lead = element.firstChild.nodeValue;
}
if (element.nodeName.toUpperCase() == "BODY") {
body = element.firstChild.nodeValue;
}
if (element.nodeName.toUpperCase() == "URL") {
URL = element.firstChild.nodeValue;
}
element = element.nextSibling;
}
content += "<a href='"+URL+"'>"+lead+"</a><br>"+body+"<br><br>";
createTextField("dynamic"+counter+"_txt", 10+counter, counter*150, 0, 150, 30);
var _txt:TextField = this["dynamic"+counter+"_txt"];
_txt.html = true;
_txt.border = true;
_txt.autoSize = true;
_txt.htmlText=content;
}
counter+=1;
story = story.nextSibling;
}
}
}
|
![]() |
![]() |
Часовой пояс GMT +4, время: 02:12. |
|
|
« Предыдущая тема | Следующая тема » |
| Теги |
| text fields , xml |
|
|