3 Replies Latest reply on Jan 15, 2011 8:41 PM by estabahn

    How to access data in TileList?


      I have a tileList with a customItemRenderer.  How can I access the text in the item renderer within the  itemClick=doSomthing() event handler? Thanks very much. My code follows:


        • 1. Re: How to access data in TileList?
          Gregory Lafrance Level 6

          Your code is missing. But in the click event of the renderer you should be able to do this:


          If you have assigned an id to the renderer component (may need to wrap in canvas or other container)







          If you do post your code we can give a better answer.


          If this post answers your question or helps, please mark it as such. Thanks!

          Adobe Flex Development and Support Services

          • 2. Re: How to access data in TileList?
            estabahn Level 1

            Trying this again:


            // My data:

                <mx:Array id="assetList">
                <mx:Object title="Video Feed 1"
                    title2="Private John Smith"
                    image="images/troop11.jpg" />
                <mx:Object title="Video Feed 2"
                    title2="Private Mike McDonald"
                    image="images/troop1.jpg" />
                <mx:Object title="Video Feed 3"
                    title2="Humvee 1"
                    image="images/humvee.png" />


            //My TileList:

            <mx:TileList id="tileList" dataProvider="{assetList}" itemRenderer="components.CustomItemRenderer"
                                columnCount="1" columnWidth="290" rowCount="4" themeColor="#000000"
                                verticalScrollPolicy="on" backgroundAlpha="0.1" variableRowHeight="true"
                                itemClick="doSomthing(param, param)"/>


            // My Custom Item Renderer (in a seperate mxml file):

            <?xml version="1.0" encoding="utf-8"?>
            <mx:HBox xmlns:mx="http://www.adobe.com/2006/mxml"
                    horizontalAlign="right" width="100%"
                <mx:VBox width="155" height="100" horizontalAlign="center">
                    <mx:Spacer height="25"/>
                    <mx:Label text="{data.title}" width="150" textAlign="center"/>
                    <mx:Label text="{data.title2}" width="150" textAlign="center"/>
                <mx:VBox horizontalAlign="center" width="110" height="110" styleName="VideoPanel" backgroundColor="#FFFFFF">
                    <mx:Image source="{data.image}" width="100" height="100"  />

            • 3. Re: How to access data in TileList?
              estabahn Level 1

              I've tried replacing itemClick="doSomthing(param, param)"

              with: itemClick="trace('clicked : ' + data.title2)". This causes the main thread to be halted.


              Seems to me that maybe the click handler should be on the renderer, not on the TileList. Is that right?