Deprecated: Assigning the return value of new by reference is deprecated in /nfs/c02/h01/mnt/46561/domains/kreativeking.com/html/wp-settings.php on line 520

Deprecated: Assigning the return value of new by reference is deprecated in /nfs/c02/h01/mnt/46561/domains/kreativeking.com/html/wp-settings.php on line 535

Deprecated: Assigning the return value of new by reference is deprecated in /nfs/c02/h01/mnt/46561/domains/kreativeking.com/html/wp-settings.php on line 542

Deprecated: Assigning the return value of new by reference is deprecated in /nfs/c02/h01/mnt/46561/domains/kreativeking.com/html/wp-settings.php on line 578

Deprecated: Function set_magic_quotes_runtime() is deprecated in /nfs/c02/h01/mnt/46561/domains/kreativeking.com/html/wp-settings.php on line 18
Cool Flash Tip of the Week 4 | kreativeKING - Interactive Developer

' 09 June, 19 - 5:13 pm

Cool Flash Tip of the Week 4

Post Header

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.


<familyTree>
    <family lastName="Travis">
        <member>Maria</member>
        <member>Jason</member>
    </family>
    <family lastName="Travolta">
        <member>Jason</member>
    </family>
    <family lastName="Crane">
        <member>Chris</member>
        <member>Jack</member>
        <member>Maria</member>
    </family>
</familyTree>


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.

No related posts.

  • Great post… good suggestions…thanks!

  • I think i've seen this somewhere before…but it's not bad at all

  • Do you know of a way to do a deep node select? Like this example:

    http://www.gotoandlearnforu...

  • April

    Pretty nice post. I just came across your blog and wanted to say
    that I have really enjoyed reading your posts. Any way
    I'll be subscribing to your feed and I hope you post again soon!

  • Nice article. Good job.

blog comments powered by Disqus