It is likely that the mx;image tag is burning you.  An image doesn't
know how big it is until the image is loaded and thus your measurements
may be off.
 
If you know the size of the images, set them in the tag.
 
I'm actually spending part of today seeing if we can make the framework
smarter about this situation.

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of David Ham
Sent: Friday, September 07, 2007 8:01 AM
To: [email protected]
Subject: [flexcoders] Unwanted scrollbars on my List
itemRenderer--measure() help?



I have a list with a custom renderer. Each item has a text field of
different length. I have variableRowHeight set to "true". When the
list first loads, it renders correctly, but when I drag something out
of it, all the items get vertical scrollbars. When I add an item back
in, it seems that just that item gets the scrollbar.

I found a thread here about overriding the measure() method in the
renderer but I'm not sure how to do it. Do I need to call any methods
on the List itself when I add or remove items?

Thanks for any help you can offer. The code for my renderer is below.

OK
DAH

<?xml version="1.0" encoding="utf-8"?>
<mx:HBox xmlns:mx="http://www.adobe.com/2006/mxml
<http://www.adobe.com/2006/mxml> " height="100%"
width="100%">
<mx:Script>
<![CDATA[
import mx.controls.Text;
import mx.controls.Image;
import com.purina.petcharts.vo.FeedItem;
import mx.controls.LinkButton;
import mx.logging.ILogger;
import mx.logging.Log;
import flash.utils.*;
import mx.events.FlexEvent;

private var log:ILogger =
Log.getLogger("com.purina.petcharts.view.FeedRenderer");

private var _data:FeedItem;



[Bindable]
override public function set data( value : Object ):void {
if ( value != null ) {
super.data = value;
_data = value as FeedItem; 
var t:String = "";
t += data.feedCategory + ": <a href=\"event:";
t += data.urlDescription;
t += "\">";
t += "<font color='#FF0000'><u>";
t += data.title;
t += "</u></font>";
t += "</a>";
itemLink.htmlText = t;
}
dispatchEvent(new FlexEvent(FlexEvent.DATA_CHANGE));
}

override public function get data():Object {
return _data;
}

private function linkHandler(event:TextEvent):void {
navigateToURL(new URLRequest(event.text), '_blank');
}

]]>
</mx:Script>
<mx:Image id="thumbnail" source="{data.imageUrl}" />
<mx:VBox id="textBox" width="100%" height="100%">
<mx:Text id="itemLink" paddingTop="0" paddingBottom="0" text
= "{'[' + data.feedType + ', ' + data.feedCategory + ']: ' +
data.title}" link="linkHandler(event)" selectable="true" width="100%"/>
<mx:Text id="itemText" text="{data.shortDescription}"
width="100%" />
<mx:Text id="source" text="Source: {data.provider}" />
</mx:VBox> 

</mx:HBox>



 

Reply via email to