webninja
04-01-2006, 07:07 AM
Hi Everyone...
I have run accross some odd behavior when using the Tile container with the Image class and I think this is a bug in the mx:Image class. I tested this by starting with the Tile sample (which lays out 9 buttons) and it worked fine. I then added code to resize the buttons, both width and height, and it worked fine.
I then replaced the Buttons with Images. The Image is set to preserve aspect ratio. When I change the height of the image, the tile container knows that the height changed but it does not seem to know that the width changed.
I suppose I could manually set the width parameter, but I'm not sure how to do that. I have to figure out how to assign the height to a var, then do a little math to caculate the width to keep the aspect ratio correct. Still, it seems that the mx:Image should handle this.
Am I missing something, or is this really a bug?
Test code here:
<?xml version="1.0"?>
<!-- Simple example to demonstrate the Tile layout -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" backgroundColor="#FFFFFF">
<mx:Panel title="Tile Panel">
<mx:HSlider value="180" tickInterval="10" allowTrackClick="true" dataTipPlacement="bottom" width="100%" height="20"
explicitMaxHeight="20" x="0" y="0" minimum="50" maximum="180" snapInterval="10" id="hsldThumbs"/>
<mx:Tile paddingBottom="10" borderStyle="inset" verticalGap="15" id="myFlow"
paddingLeft="10" backgroundColor="#FFFFCC" paddingTop="10" paddingRight="10"
horizontalGap="10" direction="horizontal">
<mx:Image id="tn1" scaleContent="true" maintainAspectRatio="true" height="{hsldThumbs.value}" source="c:\zanalyzer\test-thumbnails\TSRExport\tsr_export_1_0.jpg"/>
<mx:Image id="tn2" scaleContent="true" maintainAspectRatio="true" height="{hsldThumbs.value}" source="c:\zanalyzer\test-thumbnails\TSRExport\tsr_export_2_0.jpg"/>
<mx:Image id="tn3" scaleContent="true" maintainAspectRatio="true" height="{hsldThumbs.value}" source="c:\zanalyzer\test-thumbnails\TSRExport\tsr_export_6_0.jpg"/>
<mx:Image id="tn4" scaleContent="true" maintainAspectRatio="true" height="{hsldThumbs.value}" source="c:\zanalyzer\test-thumbnails\TSRExport\tsr_export_10_0.jpg"/>
<mx:Image id="tn5" scaleContent="true" maintainAspectRatio="true" height="{hsldThumbs.value}" source="c:\zanalyzer\test-thumbnails\TSRExport\tsr_export_1_0.jpg"/>
<mx:Image id="tn6" scaleContent="true" maintainAspectRatio="true" height="{hsldThumbs.value}" source="c:\zanalyzer\test-thumbnails\TSRExport\tsr_export_2_0.jpg"/>
<mx:Image id="tn7" scaleContent="true" maintainAspectRatio="true" height="{hsldThumbs.value}" source="c:\zanalyzer\test-thumbnails\TSRExport\tsr_export_6_0.jpg"/>
<mx:Image id="tn8" scaleContent="true" maintainAspectRatio="true" height="{hsldThumbs.value}" source="c:\zanalyzer\test-thumbnails\TSRExport\tsr_export_10_0.jpg"/>
<mx:Image id="tn9" scaleContent="true" maintainAspectRatio="true" height="{hsldThumbs.value}" source="c:\zanalyzer\test-thumbnails\TSRExport\tsr_export_1_0.jpg"/>
<mx:Image id="tn10" scaleContent="true" maintainAspectRatio="true" height="{hsldThumbs.value}" source="c:\zanalyzer\test-thumbnails\TSRExport\tsr_export_2_0.jpg"/>
<mx:Image id="tn11" scaleContent="true" maintainAspectRatio="true" height="{hsldThumbs.value}" source="c:\zanalyzer\test-thumbnails\TSRExport\tsr_export_6_0.jpg"/>
<mx:Image id="tn12" scaleContent="true" maintainAspectRatio="true" height="{hsldThumbs.value}" source="c:\zanalyzer\test-thumbnails\TSRExport\tsr_export_10_0.jpg"/>
</mx:Tile>
</mx:Panel>
</mx:Application>
I have run accross some odd behavior when using the Tile container with the Image class and I think this is a bug in the mx:Image class. I tested this by starting with the Tile sample (which lays out 9 buttons) and it worked fine. I then added code to resize the buttons, both width and height, and it worked fine.
I then replaced the Buttons with Images. The Image is set to preserve aspect ratio. When I change the height of the image, the tile container knows that the height changed but it does not seem to know that the width changed.
I suppose I could manually set the width parameter, but I'm not sure how to do that. I have to figure out how to assign the height to a var, then do a little math to caculate the width to keep the aspect ratio correct. Still, it seems that the mx:Image should handle this.
Am I missing something, or is this really a bug?
Test code here:
<?xml version="1.0"?>
<!-- Simple example to demonstrate the Tile layout -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" backgroundColor="#FFFFFF">
<mx:Panel title="Tile Panel">
<mx:HSlider value="180" tickInterval="10" allowTrackClick="true" dataTipPlacement="bottom" width="100%" height="20"
explicitMaxHeight="20" x="0" y="0" minimum="50" maximum="180" snapInterval="10" id="hsldThumbs"/>
<mx:Tile paddingBottom="10" borderStyle="inset" verticalGap="15" id="myFlow"
paddingLeft="10" backgroundColor="#FFFFCC" paddingTop="10" paddingRight="10"
horizontalGap="10" direction="horizontal">
<mx:Image id="tn1" scaleContent="true" maintainAspectRatio="true" height="{hsldThumbs.value}" source="c:\zanalyzer\test-thumbnails\TSRExport\tsr_export_1_0.jpg"/>
<mx:Image id="tn2" scaleContent="true" maintainAspectRatio="true" height="{hsldThumbs.value}" source="c:\zanalyzer\test-thumbnails\TSRExport\tsr_export_2_0.jpg"/>
<mx:Image id="tn3" scaleContent="true" maintainAspectRatio="true" height="{hsldThumbs.value}" source="c:\zanalyzer\test-thumbnails\TSRExport\tsr_export_6_0.jpg"/>
<mx:Image id="tn4" scaleContent="true" maintainAspectRatio="true" height="{hsldThumbs.value}" source="c:\zanalyzer\test-thumbnails\TSRExport\tsr_export_10_0.jpg"/>
<mx:Image id="tn5" scaleContent="true" maintainAspectRatio="true" height="{hsldThumbs.value}" source="c:\zanalyzer\test-thumbnails\TSRExport\tsr_export_1_0.jpg"/>
<mx:Image id="tn6" scaleContent="true" maintainAspectRatio="true" height="{hsldThumbs.value}" source="c:\zanalyzer\test-thumbnails\TSRExport\tsr_export_2_0.jpg"/>
<mx:Image id="tn7" scaleContent="true" maintainAspectRatio="true" height="{hsldThumbs.value}" source="c:\zanalyzer\test-thumbnails\TSRExport\tsr_export_6_0.jpg"/>
<mx:Image id="tn8" scaleContent="true" maintainAspectRatio="true" height="{hsldThumbs.value}" source="c:\zanalyzer\test-thumbnails\TSRExport\tsr_export_10_0.jpg"/>
<mx:Image id="tn9" scaleContent="true" maintainAspectRatio="true" height="{hsldThumbs.value}" source="c:\zanalyzer\test-thumbnails\TSRExport\tsr_export_1_0.jpg"/>
<mx:Image id="tn10" scaleContent="true" maintainAspectRatio="true" height="{hsldThumbs.value}" source="c:\zanalyzer\test-thumbnails\TSRExport\tsr_export_2_0.jpg"/>
<mx:Image id="tn11" scaleContent="true" maintainAspectRatio="true" height="{hsldThumbs.value}" source="c:\zanalyzer\test-thumbnails\TSRExport\tsr_export_6_0.jpg"/>
<mx:Image id="tn12" scaleContent="true" maintainAspectRatio="true" height="{hsldThumbs.value}" source="c:\zanalyzer\test-thumbnails\TSRExport\tsr_export_10_0.jpg"/>
</mx:Tile>
</mx:Panel>
</mx:Application>