views:

19

answers:

0

(Flex 3) I have a horizontally oriented TileList that is using an ArrayCollection as its data provider, and an ItemRenderer based on a simple mx:Text component.

How can I force newly added tiles to size themselves (specifically width) dynamically, according to the width of the element being added? I've tried some invalidateDisplayList() calls at various points, but the tiles seem to all size themselves the same... the width changes as new items appear, but every tile gets the same width.

Width="100%" also seemed not to work (in the itemrenderer).

I spent yesterday scouring the web, and can't find a direct answer for this.

Here's the latest state of my code. First, the TileList:

<mx:TileList
    y="550"
    id="tListPath"
    columnCount="{pathModel.inverseNodePath.length}"
    rowCount="1"
    direction="horizontal"
    itemRenderer="components.RendererNode"
    dataProvider="{pathModel.inverseNodePath}"
    itemsChangeEffect="{components.PathChangeEffect}"   
    offscreenExtraRowsOrColumns="2"
    wordWrap="false"
    width="500"
    />

And the ItemRenderer, recent attempt to invalidateDisplayList commented out...

<?xml version="1.0" encoding="utf-8"?>
  <mx:Text 
    xmlns:mx="http://www.adobe.com/2006/mxml"
    name="RendererNode"
    text="{data.text}" 
    color="0x000000" 
    fontFamily="Verdana" 
    fontSize="10"
    fontWeight="bold"
    truncateToFit="true"
    creationComplete="init()"   
    >
<mx:Script>
    <![CDATA[
        public function init():void
        {
            //this.invalidateDisplayList();
        }

    ]]>
 </mx:Script>
</mx:Text>

What does this need to look like in order for each tile to have a different width based on the width of {data.text} (ie., the element being rendered in the tile)?