How to get column width inside AS3 DataGrid CellRenderer?
<p>I have a DataGrid with one column showing picture icon(s). This is done by using a special CellRenderer. Is it possible to find column width inside the CellRenderer? <code>this.width</code> always returns a number that is obviously wrong (152), no matter what the actual column width is. I tried this on PC and on Android. </p>

<p>I need to know the column width to center the picture. It would be probably possible to pass the actual column width to the CellRenderer using a static variable, but I wonder if I'm overlooking something obvious.</p>

<pre><code>import fl.controls.listClasses.CellRenderer;
import flash.geom.Point;
import flash.text.TextFormat;
import flash.text.TextFormatAlign;
import flash.utils.*;   
import flash.events.*;

public class CustomImageCellRenderer extends CellRenderer 
{

    public function CustomImageCellRenderer()
    {   

        var iconClass : Class = getDefinitionByName("icon") as Class;
        var iconMC : MovieClip = new iconClass();

        trace("width=" + width); // always returns 152

        addChild(iconMC );      

    }

    override protected function drawBackground():void
    {
        var skin : Object;

        if (_listData.index % 2 == 0)
        {
            skin = CellRenderer_upSkin2;
        } else {
            skin = CellRenderer_upSkin;         
        }           

        setStyle("upSkin", skin);   
        setStyle("overSkin", skin); 
        setStyle("downSkin", skin); 

        setStyle("selectedOverSkin", skin); 
        setStyle("selectedDownSkin", skin);  
        setStyle("selectedUpSkin", skin);

        super.drawBackground();

    }   

}
</code></pre>