tags:

views:

47

answers:

1

when I try to loop through the children of a List component that has buttons in it, I can't seem to access those children.

I try

for(var btnNum:Number = 0; btnNum < myList.numChildren; btnNum++)
{

  trace(myList.getChildAt(btnNum);

}

but it is giving some other instance, not the button instances.

and the weeklist

<mx:List id="myList"  dataProvider="{_data.mappoints.week.@number}"  >
                <mx:itemRenderer  >
                    <mx:Component>


                        <mx:Button buttonMode="true" toggle="true"  alpha="1" width="116" height="35" label="WEEK {data}" >

                        </mx:Button>

                    </mx:Component>
                </mx:itemRenderer>
            </mx:List>
+1  A: 

Your list isn't full of buttons, it's full of components.

Do a trace(ObjectUtil.toString(myList); and you will get a good output of what your list really is and how to get to the buttons.

invertedSpear
I got to the buttons, it was pretty tedious. Seems like there should be an easier way. But I got it.
pfunc
Creating a dictionary object and storing a reference to your buttons there might make accessing them easier.
invertedSpear