Mike,

Thank you very much for your guidance.

I dug deeper and got the component fully functional.

Following is the cleaned up code.

Again, thanks for your prompt and authoritative response.

          Warmest regards,

          g


package
{
    import flash.events.Event;

    import mx.core.UIComponent;
    import mx.events.FlexEvent;

    public class MyComp extends UIComponent
    {
        public var squareSize:uint = 10;
        public var squaresTotal:uint = 13;
        public var color:uint = 0xf8b34e;

        private var currentAlpha:Number = 1.0;
        private var square:UIComponent = new UIComponent();


        public function MyComp()
        {
            super();

        }

        override protected function measure():void
        {
            super.measure();

            var width:Number = (squareSize*squaresTotal)+(
(0.25*squareSize)*(squaresTotal-1));
            measuredWidth=width;
            minWidth=width;
            measuredHeight=squareSize;
            minHeight=squareSize;
        }

        override protected function createChildren():void
        {
            super.createChildren();

            square.graphics.beginFill(color, 1);
            square.graphics.drawRect(0, 0, squareSize, squareSize);
            square.graphics.endFill();
            square.alpha = currentAlpha;
            this.addChild(square);
            for (var i:Number=1; i<(squaresTotal); i++)
            {
                square = new UIComponent();
                currentAlpha = 1.0 - (i * 1/squaresTotal) ;
                square.graphics.beginFill(color, 1);
                square.graphics.drawRect( (squareSize*1.25*i), 0,
squareSize, squareSize);
                square.graphics.endFill();
                square.alpha = currentAlpha;
                square.setActualSize(squareSize, squareSize);
                this.addChild(square);
            }
        }

    }
}

Reply via email to