I just tried a big number of things both
documented and undocumented and couldn’t get it to work correctly. I
have no idea why since this is something I thought we tested (though maybe it
was with embedded images and not dynamically loaded). I’ll file a bug on
this but I don’t have any good suggestions right now. Everything I’ve
looked at makes it seem like it should do the right thing.
Sorry!
Matt
From: Kristopher
Schultz [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 23, 2005
8:17 PM
To: [email protected]
Subject: [flexcoders] Redraw
problems with TileList and custom cell renderer
I am trying to use a custom cell renderer with the <mx:TileList>
tag.
The cell renderer displays a dynamically loaded
JPG file in each tile.
Everything works great at first, but if I try to
change the itemWidth
and itemHeight properties after the control is
initially drawn all my
images disappear. That is, until you scroll the
TileList down and up
again!?
Does anyone have suggestions on how to fix this
redraw problem? I've
included in this email the simplest example I
could come up with to
demonstrate the problem. Just save the code below
in two different mxml
files as noted. You'll need to supply your own
images as called for in
the "productList" array.
Thanks in advance for any guidance you can offer!
Kris
=== index.mxml ===
<?xml version="1.0"
encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml"
xmlns="*"
>
<mx:Script>
<![CDATA[
function doResize()
{
tileList.itemWidth = tileList.itemWidth + 20;
tileList.itemHeight = tileList.itemHeight + 20;
}
]]>
</mx:Script>
<mx:Array
id="productList">
<mx:Object label="Item 1"
imageUrl="images/single1_th.jpg" />
<mx:Object label="Item 2"
imageUrl="images/single2_th.jpg" />
<mx:Object label="Item 3"
imageUrl="images/single3_th.jpg" />
<mx:Object label="Item 4"
imageUrl="images/single4_th.jpg" />
</mx:Array>
<mx:HBox>
<mx:Panel title="Products"
width="480" height="320">
<mx:TileList
id="tileList"
dataProvider="{productList}"
cellRenderer="MyCellRenderer"
width="100%"
height="100%"
itemWidth="100"
itemHeight="100"
/>
<mx:ControlBar>
<mx:Button label="resize"
click="doResize(event)" />
</mx:ControlBar>
</mx:Panel>
</mx:HBox>
</mx:Application>
========
==== MyCellRenderer.mxml ====
<?xml version="1.0"
encoding="utf-8"?>
<mx:VBox xmlns:mx="http://www.macromedia.com/2003/mxml">
<mx:Script>
<![CDATA[
var dataObject:Object;
function setValue(str:String, item:Object)
{
dataObject =
item;
}
]]>
</mx:Script>
<mx:Image
id="theImage" width="100%" height="100%"
source="{dataObject.imageUrl}"
toolTip="{dataObject.label}" />
</mx:VBox>
========
| Yahoo! Groups Sponsor |
ADVERTISEMENT
![click here]() | |
![]() |
Yahoo! Groups Links
|