Форум 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)
-   -   атрибуты XML (http://www.flasher.ru/forum/showthread.php?t=119568)

scarbo 24.12.2008 05:04

атрибуты XML
 
Как подсчитать кол-во атрибутов и взять их в массив?

BBOY Ильич 24.12.2008 06:43

Код AS1/AS2:

var my_xml:XML = new XML('<people><person name="Вася" gender="male" age="43" weight="187"/></people>');
 
var node:XMLNode = my_xml.firstChild.firstChild;
var attributesArray:Array = [];
 
for (var attribute:String in node.attributes)
{
        attributesArray.push(node.attributes[attribute]);
}
 
trace('Количество аттрибутов: ' + attributesArray.length + '\n' + attributesArray)


scarbo 24.12.2008 11:46

ага так и думал что придется через for in.
Спасибо


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

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