I see one problem in the code. tempAC is defined only in else class.
Is the event.result.blah.blah a string if there is only one element? or is it an array/arraycllection with one element? Jay Jayaraman Central Billing Services Financial Management and Planning (404) 498-8453 (W) (404) 273-7131 (C) "Tung Lee" <[EMAIL PROTECTED]> Sent by: [EMAIL PROTECTED] 05/15/2008 10:36 AM Please respond to [email protected] To [email protected] cc Subject Re: [AFFUG Discuss] How to read ArrayCollection with one element? Kyle, I ran into that problem not too long ago. I don't know the logic behind it, but it looks like that ArrayCollection does not like single or null element. What I end up doing was adding empty elements to my XML and than sending through filterFunction which filters out the null elements. Not sure if you can modify the source data or not, but that how I end up make it work... Tung Lee On Thu, May 15, 2008 at 10:02 AM, Kyle Patterson < [EMAIL PROTECTED]> wrote: Does anyone know how to use an ArrayCollection that just has one element; I keep getting a popup error saying "property or method of a null object reference". The ArrayCollection needs to work whether it has one element or multiple elements. Here's my code, what am I doing wrong??? private var myArrayCollection:ArrayCollection; private function myFunc(event:ResultEvent):void { if(event.result.blah.blah is ArrayCollection){ //if array has multiple elements myArrayCollection = event.result.blah.blah; }else{ //if array has just one element var tempAC:ArrayCollection = new ArrayCollection(); tempAC.addItem(event.result.blah.blah); } myArrayCollection = tempAC; } Thanks in advance, Kyle ------------------------------------------------------------- To unsubscribe from this list, simply email the list with unsubscribe in the subject line For more info, see http://www.affug.com Archive @ http://www.mail-archive.com/discussion%40affug.com/ List hosted by FusionLink ------------------------------------------------------------- ------------------------------------------------------------- To unsubscribe from this list, simply email the list with unsubscribe in the subject line For more info, see http://www.affug.com Archive @ http://www.mail-archive.com/discussion%40affug.com/ List hosted by FusionLink ------------------------------------------------------------- ------------------------------------------------------------- To unsubscribe from this list, simply email the list with unsubscribe in the subject line For more info, see http://www.affug.com Archive @ http://www.mail-archive.com/discussion%40affug.com/ List hosted by http://www.fusionlink.com -------------------------------------------------------------
