Instead of using an array list and trying to emulate the type-less
abilities of AS3, I'd try to map the XML to typed objects in .NET. Or
does the XML from your Flex app differ too wildly to do this?

Are you using the XmlSerializer to deserialize this? Or are you using
WCF? Or are you doing it some other way, or manually?

I'd provide an example, but I don't know enough details on your
situation to give something useful :)

2009/7/3 Angelo Anolin <angelo_ano...@yahoo.com>:
>
>
> Hi Sam,
>
> Care to show some examples? I am parsing the arrayCollection into an
> ArrayList on .NET.  This is particularly not too appealing since I just
> discovered that for example, if one of the objects in the arraycollection
> would have an empty string value, the number of items inside the array is
> not reflected properly in .NET.
>
> Like:
>
> private var arrR:ArrayCollection = new ArrayCollection([{ID:"001",
> Value:"Select"},
>                                                         {ID:"002",
> Value:"Choose"},
>                                                         {ID:"003",
> Value:""},]);
>
> When I pass this var arrR into a .NET webservice and delegate it to an
> ArrayList, the items in the array list will have one of the arrays only
> containing 1 item (instead of 2).
>
> Adding to my problem is the fact that the arrays inside the array list when
> read in .NET should have the object ID and Value be in order but they are
> not.  This is further true when there are many items in the array
> collection.  Sometimes, the first item becomes the last one in the array
> list, and sometimes the order is not well.
>
> In any case, I am finding a solution on how I would be able to pass an
> ArrayCollection to .NET and be able to parse it properly.
>
> Thanks.
>
> ________________________________
> From: Sam Lai <samuel....@gmail.com>
> To: flexcoders@yahoogroups.com
> Sent: Thursday, 2 July, 2009 15:46:58
> Subject: Re: [flexcoders] ArrayCollection Does Not Show Items In Order When
> Passed to .NET WebService
>
> How is it being parsed in .NET? You can parse it into a hashtable, or
> better yet, use a pre-defined object.
>
> Not sure why the order is different, but it is probably fragile to
> rely on the order in this case.
>
> 2009/7/2 Angelo Anolin <angelo_anolin@ yahoo.com>:
>>
>>
>> Hi FlexCoders,
>>
>> I have an array collection which I am populating as follows:
>>
>> var oTemp:Object;
>> var xl:XMLList = _xmlData.children( );
>> var i:int;
>> for(i = 0; i < xl.length(); i++)
>> {
>>  oTemp = {ID_TAG:xl[i] .ID.text( ), CAT_TAG:xl[i] .CAT.text( ),
>> DET_TAG:xl[i] .DET.text( ), REP_DATE_TAG: xl[i].REP_ DATE.text( ),
>> IND_TAG:xl[i] .IND.text( )};
>>  arrDP.addItem( oTemp);
>> }
>> Now, when I pass back this Array Collection back into a web service, the
>> fields are not in order as I have added them into the array collection.
>>
>> I am expecting that in my Web Service, when I parse this arraycollection
>> (via arraylist), I would be getting the same order of columns as I have
>> added them, i.e. the first array in the array list would have element 0 to
>> be the value I placed in the ID.
>>
>> Since the arraylist does not have the field tag (represented by ID_TAG,
>> DET_TAG, CAT_TAG, etc..), it becomes a trial and error (hit and miss) on
>> my
>> part since I can only reference the value via the index on the array.
>>
>> Now, how would I be able to include the tags inside array collection such
>> that when I read them as an array list in my .NET webservice, I know which
>> element I am referring to in a particular index.
>>
>> Thanks.
>>
>> Regards,
>> Angelo
>>
>>
>>
>
>
>
> 

Reply via email to