Share Posted October 20, 2011 I've got a really weird problem: I have XML that's getting loaded via XMLLoader. When I assign it to an XML object, I can not access any of the nodes inside it. Here's the code: // XML (inside an external file) var myLoader:XMLLoader = new XMLLoader(_settings.loadDataURL, {name:"loadData", onComplete:onLoadData, onError:onLoaderError}); myLoader.load(); private function onLoadData(e:LoaderEvent):void { trace("Main::onLoadData()"); var _dataXML:XML = e.target.content; trace(_dataXML); // Outputs the correct XML trace(_dataXML.angle[0]); // Outputs "undefined" trace(_dataXML.children()); // Outputs both of the angle nodes correctly trace(_dataXML.angle.length()); // Outputs 0 } So although the XML data is getting loaded, and it's getting added to _dataXML, but whenever I try to access anything directly inside _dataXML, Flash thinks it doesn't exist. WTF? I feel like I'm missing something obvious but I've been banging my head against this for hours. Any ideas why this would be happening? Thanks in advance, --eric Link to comment Share on other sites More sharing options...
Share Posted October 20, 2011 Looks like the problem is that you've got an xmlns attribute defined. Remove that and you're golden. Link to comment Share on other sites More sharing options...
Author Share Posted October 20, 2011 Wow - it's always the simplest thing that causes the biggest problems. Thanks much!! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now