📜 ⬆️ ⬇️

Search function tags on XML tree in flash, which is so lacking

Only for flashers :) Imitation of something like document.getElementByName ()


We have an XML tree of XML class
How to find a tag with a given name?

Add this code to the beginning of the video.
XMLNode.prototype.getChildByTagName = function (name) {
for (child in this.childNodes) {
if (this.childNodes [child] .nodeName == name) return this.childNodes [child];
if (this.childNodes.length> 0) {
childResult = this.childNodes [child] .getChildByTagName (name);
if (childResult) return childResult;
}
}
return false;
}

')
After that you can write a code like
trace (this.getChildByTagName ("buttn_play"). nodeName);


for tree species
<? xml version = "1.0" encoding = "UTF-8"?>
<skin>
<lol>
<b_lol />
<buttn_play img = "img / play.png" hover = "img / play_hover.png" down = "img / play_down.png" />
<b_lol2 />
</ lol>
</ skin>

Source: https://habr.com/ru/post/5961/


All Articles