Home / Tutorials / ActionScript / Loading and using XML data in AS3 /

Flash Tutorials

Loading and using XML data in AS3 - Step three: Retrieving information

Posted by : FireCode on Jun 10, 2010

 

5.0/5

Now that we have loaded the XML file, we can do a trace to see what has been loaded.

trace(_xml);

Using the * ( asterisk ) or .children() method we can list all the children of a node.

trace(_xml.*);

Or

trace(_xml.children() );

You will notice that the root node is gone that's because we are listing its children.

We can select a certain selection of nodes.

trace(_xml.song);

This will display the following data:

rock.mp3 jazz.mp3

If we need to retrieve the value of a specific node we can use square bracket operator and a number indicating the position of the child in the XML file.

trace(_xml.song[0]);

This will display the following data:

rock.mp3


FireCode is a promising project created by a couple of passionate Flash developers. Our purpose is to help you understand how Flash works and show you how to develop or customize your components.

We hope you enjoyed this tutorial. Don't forget to visit our portfolio to see our awesome Flash components.

no comment

Add comment

Please login to post comments.