I'm having an issue with finding the length of the number of children items in
my ArrayCollection. A small part of the xml that is being pulled in is below.
You'll see that I have a node <links> with a child or children node <link>. If
I have 2 or more <link> nodes then the length comes back with the proper
number, but if I only have 1 it comes back as undefined. Here's my basic
function that I'm putting together now
private function dgChanged(evt:Event):void {
if (myADG.selectedItem.links != null) {
trace(myADG.selectedItem.links.link.length);
} else {
trace ("NULL" );
}
<items>
<item>
<eID>4</eID>
<eName><![CDATA[3 Event with link]]></eName>
<sDate>1/2/2010</sDate>
<eDate>2/18/2010</eDate>
<sTime>12:00:00 PM</sTime>
<eTime>3:00:00 PM</eTime>
<description><![CDATA[Lorem Ipsum is simply dummy text of the
printing and typesetting industry. Lorem Ipsum has been the industry's standard
dummy text ever since the 1500s, when an unknown printer took a galley of type
and scrambled it to make a type specimen book. It has survived not only five
centuries, but also the leap into electronic typesetting, remaining essentially
unchanged. It was popularised in the 1960s with the release of Letraset sheets
containing Lorem Ipsum passages, and more recently with desktop publishing
software like Aldus PageMaker including versions of Lorem
Ipsum.]]></description>
<aName>AIT</aName>
<cName>Learning</cName>
<lName>UK</lName>
<links>
<link ID="1" description="description of the link"
title="Apple" url="www.apple.com"/>
</links>
</item>
Any ideas as to why I'm getting "undefined"?
Thanks,
Mark