Sorry for all the bug spewing here, this is mostly so I can register these things in Google for when I forget them next... That being said, if you see something I'm overlooking, love to know about it as always : ).
So it seems XmlNode's attributes property doesn't derive from object. Specifically it's prototype is undefined, so it can't see things like toString(), or anything else in object.prototype. Man there are so many of these little things with teh Flash API, and each one takes so much time (and special case code, yuck). Well the bright side is our C# (or VB) product won't have these problems - or well I guess they will have them, but also have automatically inserted workarounds, which is almost as good as not having them. Ok, nothing is almost as good as not having them, what am I saying.
That being said, not sure how to “automatically work around” this one. We have some stuff in object prototype that helps with things like foreach in C#. I guess test to see if Xml attributes are being enumerated and send it to a special static method. Yeeuch.
For the record, here is the test:
Object.prototype.xx = 5;
var src = "<?xml version='1.0' ?><!DOCTYPE xxx><test name='boo'><test2>text</test2><test3/></test>";
var x = new XML(src);
trace(x.firstChild.attributes["name"]); // boo
trace("atr: " + x.firstChild.attributes.xx);
trace(src.xx);
trace(x.xx);
trace(x.childNodes.xx);
trace(x.contentType.xx);
trace(x.docTypeDecl.xx);
trace(x.firstChild.xx);
trace(x.ignoreWhite.xx);
trace(x.lastChild.xx);
trace(x.firstChild.firstChild.nextSibling.xx);
trace(x.firstChild.nodeName.xx);
trace(x.firstChild.nodeType.xx);
trace(x.firstChild.firstChild.firstChild.nodeValue.xx);
trace(x.firstChild.parentNode.xx);
trace(x.firstChild.firstChild.nextSibling.previousSibling.xx);
trace(x.status.xx);
trace(x.xmlDecl.xx);
posted on Thursday, February 24, 2005 6:15 PM