468,791 Members | 1,649 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,791 developers. It's quick & easy.

Get some info from my XML?

I want to grab the amount of images in each <subnumber> section. How?

I have this code in Flash;

Expand|Select|Wrap|Line Numbers
  1. var pArray = new Array();
  2. var tArray = new Array();
  3.  
  4. var myXML:XML = new XML();
  5. myXML.ignoreWhite = true;
  6. myXML.onLoad = function (success:Boolean):Void {
  7.     if (success) {
  8.         var xmlData = this.firstChild.childNodes[0].childNodes[0];
  9.         for (var i = 0; i<xmlData.childNodes.length; i++) {
  10.             pArray.push(xmlData.childNodes[i].childNodes[0].firstChild.nodeValue);
  11.             tArray.push(xmlData.childNodes[i].childNodes[1].firstChild.nodeValue);
  12.         }
  13.         containerMC.loadPic(0);
  14.         picInfo.alphaTo(100, speed_fadeIn, tweentype_fadeIn, speed_fadeIn);
  15.     } else {
  16.         picInfo.text = "Unable to load external file.";
  17.     }
  18. }
  19. myXML.load("xml/XMLdata.xml")
And this is my XML in short:

[PHP]<?xml version="1.0" encoding="iso-8859-1" ?>

<xmlData>
<main>
<subnumber>
<subinfo>
<path>main1/images1/01.jpg</path>
<info><![CDATA[<p>main1, sub1</p>]]></info>
</subinfo>
<subinfo>
<path>main1/images1/02.jpg</path>
<info></info>
</subinfo>
<subinfo>
<path>main1/images1/03.jpg</path>
<info></info>
</subinfo>
</subnumber>
<subnumber>
<subinfo>
<path>main1/images2/01.jpg</path>
<info><![CDATA[<p>main1, sub2</p>]]></info>
</subinfo>
<subinfo>
<path>main1/images2/02.jpg</path>
<info></info>
</subinfo>
</subnumber>
</main>
</xmlData>[/PHP]
Oct 24 '06 #1
0 1924

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

7 posts views Thread by ivan_oj28 | last post: by
10 posts views Thread by Frank | last post: by
4 posts views Thread by Alberto | last post: by
5 posts views Thread by Lloyd Dupont | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
2 posts views Thread by Marin | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.