views:

14

answers:

2

Hi,

I've got a tileList in a Flex 3 website. I want to programmtically turn off the visibility of a tile. So for example:

<mx:ArrayCollection id="myAC">
    <mx:Array>
    <mx:Button id="first" label="1" />
    <mx:Button label="2" />
    <mx:Button label="3" />
    <mx:Button label="4" />
    </mx:Array>
</mx:ArrayCollection>

<mx:TileList  
    id="myTL"
    dataProvider="{myAC}"
    width="400"
        height="400"
        columnCount="2"
        rowCount="2"
    />

<mx:Button id="turnOffVisibility" click="visibleOff(event)" />


 private function removey(event:MouseEvent):void {
    myTL.getChildAt(0).visible=false;

    } 

I'm not able to "grab" the first item in the arrayCollection and set its visibility to false.

What am I doing wrong? Any suggestions?

Thank you.

-Laxmidi

A: 

dataProvider is not collection of controls. It is collection of description objects. It is itemRenderer who actually present inside of TileList. I guess you mean Tile instead of TileList? If so, just put your buttons in Tile and control them directly.

alxx
Hi alxx, Thank you for your message. I re-wrote it and put a button in an itemRenderer. I change the buttons in the arrayCollection to objects.
Laxmidi
A: 

Remove the item from the dataProvider, and the List control will update correspondingly.

Gregor Kiddie