6 Replies Latest reply on Jul 5, 2011 3:14 AM by daslicht

    How to handle many Arrays(ArrayCollections)

    flexx0r Level 1

      Hi Flex Community,

       

      I wanted to know how to handle multiple arrays. How the arrays look like you can see in the image. There you can see a result with a php function. This will be realised with an value object.

       

      ArrayCollection.PNG

       

      This happens with:

       

      vOLogin = loginResult.lastResult[0] as VOLogin;

       

      At the moment things like this aren't a problem:

       

      trace(vOLogin.username);

       

      But now I am standing in front of a riddle... how to get "gruppe" or the more difficult "w" oder "r"

       

      My tries looks like this:

       

      trace(vOLogin.Client.getItemAt(0).valueOf(gruppe));

       

      But I didn't get anything absolutely nothing..

       

      Hope someone has an idea

       

      Greetings

      flexx0r

        • 1. Re: How to handle many Arrays(ArrayCollections)
          daslicht Level 2

          Moin,

          Could you post a the VO itself please.

          Where is that screenshot taken from?

           

           

          Marc

          • 2. Re: How to handle many Arrays(ArrayCollections)
            flexx0r Level 1

            Hi thelight

             

            My PHP File for VOLogin looks like this:

             

            <?php
            class VOLogin {
                 public $id;
                 public $valid;
                 public $msg;
                 public $username;
                 public $password;
                 public $Client;
            }
            ?>

             

            I am just wondering for what you need it..

             

            That screenshot is taken from the ZendAMFBrowser.

             

            Gruß

            flexx0r

             

            Message was edited by: flexx0r

            • 3. Re: How to handle many Arrays(ArrayCollections)
              daslicht Level 2

              That ZendAMF Browser looks nice, I meant the AS3 VO

               

              Have you tried : vOLogin.Client[0].gruppe ?

               

               

              What is vOLogin ?

              • 4. Re: How to handle many Arrays(ArrayCollections)
                daslicht Level 2

                Probably this helps in some way:

                 

                <?xml version="1.0" encoding="utf-8"?>
                <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
                                  xmlns:s="library://ns.adobe.com/flex/spark" 
                                  xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600"
                                  creationComplete="application1_creationCompleteHandler(event)"
                                  >
                     <fx:Script>
                          <![CDATA[
                               import mx.collections.ArrayCollection;
                               import mx.events.FlexEvent;
                               [Bindable] public var ac:ArrayCollection;
                               
                               protected function application1_creationCompleteHandler(event:FlexEvent):void
                               {
                                    var b:Array = new Array();
                                         b.push( {username:'toller user name hier'});
                                    var a:Array = new Array();
                                         a.push({name:"Employee 1", manager:false, client:b});
                                         trace(a[0].client[0].username)
                                    
                                         ac = new ArrayCollection();
                                         ac.source = a;
                                         trace(ac[0].client[0].username);          
                               }
                          
                          ]]>
                     </fx:Script>
                </s:Application>
                
                • 5. Re: How to handle many Arrays(ArrayCollections)
                  flexx0r Level 1

                  Hey thanks,

                   

                  but I solved it my way. The thing I already get an nested array back. I just wanted to know how get I use it..

                   

                  trace(vOLogin.Client[0]['name']);

                   

                  was the solution.

                   

                  But thank you in anyway for trying to help me!

                   

                  Greetings

                  flexx0r

                  • 6. Re: How to handle many Arrays(ArrayCollections)
                    daslicht Level 2

                    I am happy that you have found the answer,

                     

                    It was a pleasure to help help you.

                     

                    Cheers

                    Marc