Mailing List
Home
Flash Pro
Extending Flash
Flash Macromedia Developer
Subjects
Firework Effect
setInterval bug identified and fixed
setInterval bug identified and fixed
ScrollPane component doesn 't auto update
Help: MX 2004 How to script a print button to print the entire sli
Event Dispatcher between classes
memory management removeMovieClip /
MX2004 Dataset itemClassName
Order of events per frame
XML to Object help
Textfield prototype question
Flash and QuickTime VR
Reading and displaying RSS feeds in Flash MX
Flash MX 2004 Sucks
AW: [Flashcoders] Switch/Case vs If/else
AW: [Flashcoders] Switch/Case vs If/else
Flash Interface with 10mb xml file
Web Service Results
Listener Object 's best practice
 
Search:  
Power your search with and, or, +, -, or "some phrase" operators.
Recursion woes

Recursion woes

2004-02-22       - By Iv

 Back
Reply:     1     2  

Hello Richard,

yep.

// source: proto.layer51.com/d.aspx?f=1098
// Ivan Dembicki
XMLNode.prototype.addProperty( "tabbedString ", function(t) {
var j, s, a, n = this.firstChild, f = arguments.callee;
while (n != undefined) {
if (n.nodeType != 3) {
a=n.attributes, s += " "+t+ " < "+n.nodeName; for (j in a) {s += " "+j+ "=\ " "+a[j]+ "\ " "; }
s += (n.firstChild ? " >\n "+f.call(n, t+ "\t ")+t+ " </ "+n.nodeName+ " >\n " : " / >\n ");
} else {
s += t+(n.toString() != n.nodeValue ? " <![CDATA[ "+n.nodeValue+ "]] > " : n.nodeValue)+ "\n ";
}
n = n.nextSibling;
}
return s;
}, null)
///////////////////////////////////////////////////
my_xml = new XML();
my_xml.load( "data.xml ");
my_xml._parent = this;
my_xml.ignoreWhite = true;
my_xml.onLoad = function(ok) {
if (!ok or this.status) {
return trace( "loaded: "+ok+ " valid: "+!this.staus);
}
var x = new XML( " <menu/ > ");
this._parent.toShort(x.firstChild, this.firstChild);
this._parent.short_xml = x;
trace( "rezult: ");
trace(x.tabbedString);
};
this.toShort = function(to_xml, in_xml) {
var fn = arguments.callee;
var i = 0, j = 0;
var nod, n, at, a = in_xml.childNodes, len = a.length;
for (i; i <len; i++) {
nod = a[i];
if (nod.nodeName == "PAGE ") {
to_xml.appendChild(new XMLNode(1, "PAGE "));
at = to_xml.lastChild.attributes;
at.label = nod.attributes.TITLE
at.loID = nod.parentNode.attributes.ID
at.pID = nod.attributes.ID
} else if (nod.nodeName == "LO ") {
to_xml.appendChild(new XMLNode(1, "LO "));
at = to_xml.lastChild.attributes;
at.label = nod.attributes.TITLE;
at.loID = nod.attributes.ID;
fn(to_xml.lastChild, nod);
}
}
};
///////////////////////////////////////////////////
n_xml = new XML();
n_xml.load( "needed.xml ");
n_xml._parent = this;
n_xml.ignoreWhite = true;
n_xml.onLoad = function(ok) {
if (!ok or this.status) {
return trace( "loaded: "+ok+ " valid: "+!this.staus);
}
trace( "needed: ");
trace(this.tabbedString);
};

--
Ivan Dembicki
__ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ___
iv@(protected) | | http://www.design.ru


=-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
Supported by Fig Leaf Software
=-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
Be sure to check the archives and the wiki:
http://chattyfig.figleaf.com/
=-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
http://chattyfig.figleaf.com/cgi-bin/ezmlm-cgi?1:mss:104918
=-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
To unsubscribe send a blank e-mail to:
Normal Mode: flashcoders-unsubscribe@(protected)
Digest Mode: flashcoders-digest-unsubscrive@(protected)