Components don't set explicitWidth and explicitHeight on themselves, they're
(optionally) set by the container, and actual sizing is set by the container
through setActualSize().

Override measure(), and set measuredWidth and measuredHeight to match your
label, and your problems may go away. Also in updateDisplayList you want to
set the actual size of the label to the minimu of it's measured size and
unscaledWidth x unscaledHeight.

-Josh

On Wed, Jul 16, 2008 at 2:07 AM, polestar11 <[EMAIL PROTECTED]> wrote:

> Hi
>
> I've been working with custom components & only just noticed a strange
> re-drawing issue where I get ghost versions of the children in my
> component appearing.
>
> I've only just noticed this since I set the child's position relative
> to unscaledWidth, which changes and so allows me to see N different
> older versions of the child. This is quite worrying because this means
> in my other versions where I the child position is static there are
> possibly N occurances of my child component.
>
> Why would this ghosting be happening and is there anything one can do
> to purge older instances?
> Here's a screenshot of the ghosting:
> http://img395.imageshack.us/img395/7826/ghostredrawingpq9.jpg
>
> Here's the code:
> import mx.controls.Label;
> import mx.core.UIComponent;
>
> public class TestComponent extends UIComponent  {
>
>        private var label:Label;
>        public function TestComponent()         {
>                super();
>        }
>        override protected function createChildren() : void {
>                super.createChildren();
>        if(!label) {
>            label = new Label();
>                        label.text = "A LABEL";
>            addChild(label);
>        }
>        explicitWidth = 200;
>        explicitHeight = 200;
>        }
>        override protected function updateDisplayList( unscaledWidth:Number,
> unscaledHeight:Number ):void {
>                super.updateDisplayList(unscaledWidth, unscaledHeight);
>
>                label.setActualSize(label.measuredWidth,
> label.measuredHeight);
>        }
> }
>
>
>
>
> ------------------------------------
>
> --
> Flexcoders Mailing List
> FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
> Search Archives:
> http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups
> Links
>
>
>
>


-- 
"Therefore, send not to know For whom the bell tolls. It tolls for thee."

:: Josh 'G-Funk' McDonald
:: 0437 221 380 :: [EMAIL PROTECTED]

Reply via email to