What you probably need to know is that the graphics layer of a sprite is
always behind all children of the sprite.  The TextArea is a Sprite
containing a child border and a TextField and sometimes scrollbars.
 
You can probably add another Shape to the TextArea and top of all the
other children and draw in there.
 
-Alex

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Mark Ingram
Sent: Thursday, May 10, 2007 2:36 AM
To: [email protected]
Subject: RE: [flexcoders] Custom Drawn TextArea / How To Implement
Custom Drawn Sprite



I used the following code:

protected override function updateDisplayList(unscaledWidth:Number,
unscaledHeight:Number):void

                        {

 
super.updateDisplayList(unscaledWidth, unscaledHeight);

                                    

                                    this.graphics.lineStyle(10,
0xFF0000);

                                    this.graphics.drawCircle(5, 5, 50);

                        }

And it draws a circle in the top left corner that goes anti-clockwise
from 90 degrees to 180 degrees (the other quarter of the circle can't be
seen because it is drawn beneath the actual TextArea!!).

How can I get my drawing to appear on top of the TextArea?

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Mark Ingram
Sent: 10 May 2007 09:44
To: [email protected]
Subject: [flexcoders] Custom Drawn TextArea / How To Implement Custom
Drawn Sprite

Hi, I want to inherit from TextArea and just tweak it's visual
appearance when the control is disabled and the user has clicked on it
(essentially I want to draw a red square around the outside).

How is the best way to do this? I tried overriding updateDisplayList,
but I couldn't draw anything in there. Do I need to make a programmatic
skin, or do I need to make a new control, one which is based on
UIComponent, but has a TextArea contained on it?

Also - If I create a new component from scratch, say from inheriting
from Sprite, what functions do I need to override in order to get it to
paint / resize / update correctly?

i.e. In windows, I know I need to override WM_PAINT / OnPaint, and then
to cause a repaint I can do InvalidateRect() or Update() to cause
immediate repaint. What is the equivalent in Flex?

Thanks,

Mark

 

Reply via email to