I know last week I said we will be learning about a custom class, but I think I'll hold that one for next week. This week we are going to check out a quick and useful tip that I didn't even know about until a couple of days ago for selecting XML and XMLList nodes. This won't be as in depth as the last, but I still think its a great quick tip.
We will be testing on this XML file.
Maria
Jason
Jason
Chris
Jack
Maria
I recently found out this cool way to select XML nodes. You can actually test attributes to filter out which ones you want. Check out the example for a better idea of what I mean.
var l:URLLoader = new URLLoader();
l.addEventlistener(Event.COMPLETE, xmlLoaded);
l.load(new URLRequest("ourXML.xml"));
function xmlLoaded(e:Event):void
{
var myXML:XML = XML(l.data);
trace(myXML.family.(@lastName == "Travis").member); // Outputs Maria , John
}
Using this method you can easily filter out a selection of nodes based on an evaluation. I find this a better way to the alternative of using array indices to select a particular tree. This is a pretty quick tip that I thought would be helpful. Next week, we are back to the in depth tips like usual. Again, if you like the post, subscribe to the RSS Feed.
Awesome tip man! Keep posting!
ReplyDelete[...] Cool Flash Tip of the Week 4 | kreativeKING - Interactive Developer Posted in PHP, Web Design | Tags: and-, and-furthering, css, design, development, [...]
ReplyDeleteNice article. Good job.
ReplyDelete[...] DIRECT LINK » [...]
ReplyDeletePretty nice post. I just came across your blog and wanted to say
ReplyDeletethat I have really enjoyed reading your posts. Any way
I'll be subscribing to your feed and I hope you post again soon!
Do you know of a way to do a deep node select? Like this example:
ReplyDeletehttp://www.gotoandlearnforum.com/viewtopic.php?f=29&t=25695
I think i've seen this somewhere before…but it's not bad at all
ReplyDeleteGreat post… good suggestions…thanks!
ReplyDelete