Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
Locked
0

Converting Array Objects into ArrayCollections

Guest
Jan 25, 2011 Jan 25, 2011

Hi,

I am facing problem with converting Array Objects into ArrayCollections. How can i convert Array Objects into ArrayCollections. If any one knows how can we do that Pl reply.

Thanks in advance to all

Regards

---------

subbareddy.p

18.5K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Jan 25, 2011 Jan 25, 2011

var array:Array = ["one", "two", "three"];

var arrayCollection:ArrayCollection = new ArrayCollection(array);

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jan 27, 2011 Jan 27, 2011

HI spoboyle,

Thanks for your reply.

I know how to connvert simple array to arraycollection. My problem is I want to convert array objects to array collection.

Right now i am working with PHP. The PHP server returned "ObjectProxys" with Remote services. Here i explained below, check it once

var proxy:ObjectProxy = ObjectProxy(data.result);  //here i catched the result returned my server.
            var obj:Object = proxy.object_proxy::object; //here i converted objectProxy to Object
            var arry:Array = ArrayUtil.toArray(obj);  //here i converted Object to Array
           
            var arrycoll:ArrayCollection = new ArrayCollection(arry) // Here i converted array to ArrayCollection

The problem is when i convert Array to ArrayCollection. The Arraycollection "arrycoll" contains arrycoll[0] with Three Objects as [2],[3],[4]. When i bind this Arraycollection  to datagrid. The datagrid was displaying Objects in every column. How can i solve this problem.

Thanks in advance to all.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jan 27, 2011 Jan 27, 2011

@sss999sss,

Can you show me the screen shot for the proxy variable in the results expressions window so that I can have a look at how your result data is coming.

var proxy:ObjectProxy = ObjectProxy(data.result);

Thanks,

Bhasker

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jan 28, 2011 Jan 28, 2011
LATEST

Hi Bhasker,

thanks for u r reply. Here i attached screen shot of my server "data.result".

resultData.png

My proxy varaible contains

proxy.png

My object varaible "obj" contains

obj.png

After parsing the result my arraycollection contains, (i mean after converting Object to Array to ArrayCollection) the below information. For information Pl find the attached arraycollection.png image. In the attached image my arraycollection name is "users".arraycollection.png

Here i pasted the code that i used  to convert  "ObjectProxy" to "ArrayCollection"

var proxy:ObjectProxy = ObjectProxy(data.result);
            var obj:Object = proxy.object_proxy::object;
            var arrycoll:Array = ArrayUtil.toArray(obj); 
            model.users = new ArrayCollection(arrycoll);

Regards

----------

sss

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines