Yes, when resultFormat=object, that's how it works.  You might think resultFormat=array would be what you wanted, but it's even worse.  It returns an array, alright, but it's just an array containing this result, which can still be either a single object or an arraycollection.  I wish there was a resultFormat=array2 that would return it like shown below.  Would make it less of a hassle.

On 7/11/06, meathead <[EMAIL PROTECTED]> wrote:

Awesome. This works. Thanks. I don't know what going on here, but
here is the code that I used to loop thru. I'm assuming that the
HTTPService event is pulled in as an ArrayCollection if more than
one record is returned.

********CODE***********



import mx.collections.*;
import mx.controls.Alert;

public function afterSend():void
{
var a:Array;
if(HTTPService.lastResult.CircSec.CircuitID is
ArrayCollection)
{
a = HTTPService.lastResult.CircSec.CircuitID.source;
}else{
a = [HTTPService.lastResult.CircSec.CircuitID];
}
for (var i:int = 0; i < a.length; i++) {
Alert.show (a[i].FromBusName);
}
}

*********END OF CODE****************
--- In flexcoders@yahoogroups.com, "Pan Troglodytes"

<[EMAIL PROTECTED]> wrote:
>
> I'm not exactly sure where you're running into the problem, as I
don't use
> toArray. But here's how I solved the whole one result/multiple
results
> problems, translated to use your terms:
>
> var a:Array;
> if (httpservice.lastResult.CircSec.CircuitID is ArrayCollection)
> a = httpservice.lastResult.CircSec.CircuitID.source
> else
> a = [httpservice.lastResult.CircSec.CircuitID];
>
> Hope that helps.
>
>
> On 7/10/06, meathead <[EMAIL PROTECTED]> wrote:
> >
> > Hi all and thanks in advance,
> >
> > I have a combo box that fires off an HTTPService based on results
> > from selection. From this HTTPService, I want to make a new pane
> > for each record returned in an accordion. I was returning correct
> > answers for multiple records, but not for results that numbered
in
> > one. Then I saw the mx.utils.ArrayUtil.toArray() thing and now I
> > can only return results that number in one and not multiple.
> >
> > Question #1: Is this a good route to follow if I want to
> > dynamically want to fill the panes of an accordion based on
results
> > from a query via XML. Or should I scrap and do something cooler.
> >
> > Question #2: This only returns answers for conditions when one
> > record is returned. How do I get it to work with multiple
answers?
> > I'm thinking this has something to do with it not grabbing the
> > correct length in the for loop.
> >
> > Here is some code.
> >
> > <mx:Script>
> > <![CDATA[
> > import mx.collections.*;
> > import mx.controls.Alert;
> > import mx.utils.ArrayUtil;
> > [Bindable]
> > public var resultArray:ArrayCollection;
> > public function afterSend():void
> > {
> > var arrData:Array = new Array;
> > arrData = mx.utils.ArrayUtil.toArray
> > (event.lastResult.CircSec.CircuitID);
> >
> > for (var i:int = 0; i < arrData.length; i++) {
> > Alert.show (arrData[i].FromBusName);
> > }
> >
> > }
> >
> > Thanks again,
> > Aaron
> >
> >
> >
>
>
>
> --
> Jason
>




--
Jason __._,_.___

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com





SPONSORED LINKS
Web site design development Computer software development Software design and development
Macromedia flex Software development best practice


YAHOO! GROUPS LINKS




__,_._,___

Reply via email to