Solved

Getting Object Info

Posted on 2004-03-25
4
157 Views
Last Modified: 2010-04-03
I'm trying to create a listbox of items within my Object. Below is the structure of my object, basically I want to be able to loop through the object and extract 'defaultControls' and 'controlSet1' from it.

Variable _level0.my_so = [object #237, class 'SharedObject'] {
    data:[object #238, class 'Object'] {
      defaultControls:[object #239, class 'Object'] {
        0:[object #240, class 'Object'] {
          screenname:"ios",
          icon:3,
          bkgd:0,
          template:3,
          selected:true,
          deleted:false,
          },
          prev:[object #240, class 'Object'],
          c:1
        }
      }
      controlSet1:[object #240, class 'Object'] {
        0:[object #240, class 'Object'] {
          screenname:"ios",
          icon:3,
          bkgd:0,
          template:3,
          selected:true,
          deleted:false,
          },
          prev:[object #240, class 'Object'],
          c:1
        }
      }
    },
    onStatus:[function 'onStatus']
  }


So far i've tried:

      for (i in _root.my_so.data){
      fileList.addItem(_parent.my_so.data[i]);
        }

      for (i in _root.my_so.data){
      fileList.addItem(_parent.my_so.data[i].name);
        }

      for (i in _root.my_so.data){
      fileList.addItem(_parent.my_so.data[i].label);
        }

none of these are giving me the output i want. Please help!
0
Comment
Question by:WebArchitect_Vince
  • 2
4 Comments
 
LVL 2

Expert Comment

by:JabbyPanda
ID: 10680823
What type of data do you want to be displayed in List component?

You mentioned, you want to list items 'defaultControls' and 'controlSet1'  from  your 'my_so' object.

If you will type trace (_root.my_so.data.defaultControls); you will see no literal output.

You can add a property 'objectName' of a type String to the 'defaultControls' and 'controlSet1'  objects and output the value of this property in List.
0
 
LVL 9

Accepted Solution

by:
krishnaprathab earned 500 total points
ID: 10702095
Though I dont understand your code fully Iam just trying to help you out with my very little knowledge.

The first odd thing which I see in the code is that you are trying to populate the list box with an Object which is not possible.

Second , your my_so object doesnt contain a "name" property which you can directly refer to. As I can learn from your code your Object structure is something like : my_so ( data ( defaultControls ( 0 ( screenname, icon,.....) ) ) ) so if you want to get the value of screename you would write a code something like _level0. my_so.data.defaultControls.0.screenname.

The third is your addressing method :

for (i in _root.my_so.data){
fileList.addItem(_parent.my_so.data[i].label);
}

Intially you have your my_so Object ar _level0 and in the above code your are using _root and _parent. You can try with the same _level0 instead.

Hope this helps and as I said iam not really able to understand your code completly so please excuse me if iam wrong.

Thanks,
KP
0
 

Author Comment

by:WebArchitect_Vince
ID: 10769761
I've come to the conclusion that the only way to do it is to add a unique id to each object and call it using that name instead.

Thanks for your help guys.

Mod: Please close this question
0
 
LVL 9

Expert Comment

by:krishnaprathab
ID: 10911022
No Assist :(
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Here are some practices and techniques that can be adopted into your Flash/Flex application development process. Note: Not all "performance tips" provide an immediately-recognizable benefit.   This article does not include timing validation data,…
In my long career of working as an actionscript developer, I had spent sleepless night often working hard to solve some small problems which actually took a lot of my development time; later found out the solutions to be a line or two. Here are s…
The goal of the tutorial is to teach the user how to how to record live broadcast.
The goal of the tutorial is to teach the user how to use the auto adjust feature and what the different options do. When your video is not working right you can choose the auto adjust feature to help choose your settings.

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question