Hi All
I'm writing an item renderer based on a Canvas. I have the following methods
(the canvas just has a label as a child)
override protected function measure():void
{
super.measure();
var metrics:EdgeMetrics = viewMetricsAndPadding;
measuredWidth = _label.width + metrics.left + metrics.right;
measuredHeight = _label.height + metrics.top + metrics.bottom;
}
override protected function updateDisplayList(unscaledWidth:Number,
unscaledHeight:Number):void
{
super.updateDisplayList(unscaledWidth, unscaledHeight);
var metrics:EdgeMetrics = viewMetricsAndPadding;
_label.x = (unscaledWidth-(_label.width+metrics.left+metrics.right))/2;
_label.y =
(unscaledHeight-(_label.height+metrics.top+metrics.bottom))/2;
}
What's wrong with these methods? why do they get continually called? At the
moment this hangs the application.
If I add a bit of padding it works fine.
_label.x and _label.y are both set to 0 in the above case.
--
Giles Roadnight
http://giles.roadnight.name