I'm using Alex Harui's example code for centering a checkbox within a
datagrid. Within my Flex folders I have a class folder so:
com -> toro -> classes and an AS file called CenteredCheckBox.as so:

package com.toro.classes
{
import flash.display.DisplayObject;
import flash.text.TextField;
import mx.controls.CheckBox;

public class CenteredCheckBox extends CheckBox
{

        public function CenteredCheckBox()
        {
                super();
        }

        /**
         *  center the contentHolder
         */
        override protected function updateDisplayList(w:Number, h:Number):void
        {
                super.updateDisplayList(w, h);

                var n:int = numChildren;
                for (var i:int = 0; i < n; i++)
                {
                        var c:DisplayObject = getChildAt(i);
                        if (!(c is TextField))
                        {
                                c.x = (w - c.width) / 2;
                                c.y = 0;
                        }
                }
        }

}

}

within my DataGrid i have for one of the DataGridColumns:

itemRenderer="CenteredCheckBox"

but the compiler tells me 1172:Definition CenteredCheckBox could not
be found, despite having imported it with 

import com.toro.classes.CenteredCheckBox;

Where have I gone wrong please?


Reply via email to