features from the Canvas. I'm trying to build a control that has a
mixture of drawn elements with other components that are sited in the
control.
So if I subclass the UIComponent I think I will loose the ability to
add child controls (although I haven't try).
I was not aware of the fact that the Canvas will add a child
component for the background. I guess it must be related to the
rawChildren property. I'm going to try also to override the
createChildren method to avoid this.
As a side note. I feel that this hidden hierarchy of controls (i.e.
background child) may be a misfeature in Flex. They should probably
consider removing it from the public API.
thanks,
-Sergio
--- In [email protected], "Gordon Smith" <[EMAIL PROTECTED]> wrote:
>
> Try subclassing UIComponent instead of Canvas. That should avoid the
> problems of having a background child.
>
> - Gordon
>
>
> -----Original Message-----
> From: [email protected]
[mailto:[EMAIL PROTECTED] On
> Behalf Of sergio_trejo_r
> Sent: Tuesday, May 23, 2006 4:37 PM
> To: [email protected]
> Subject: [flexcoders] Drawing in a Canvas subclass
>
> Hi, I ran into a problem while trying to use the drawing API in a
> subclass of the Canvas container. See the code include below.
>
> The class TestCanvasDrawing extends the Canvas container. I attempt
> to draw a line in the updateDisplayList method. However when I see
> the output only a small portion of the line is drawn in the top-left
> corner. The rest of the line seems to be clip by the background.
>
> If I then set the alpha property to 0.5 and then I can see the full
> line drawn underneath the background.
>
> So it seems that I'm getting a wrong graphics instance or I'm
missing
> some background configuration of the canvas. Has anybody seen this
> behavior or know what's the right usage?
>
> thanks!
> -Sergio
>
>
> public class TestCanvasDrawing extends Canvas
> {
> private var _canvas : Canvas;
>
> public function TestCanvasDrawing()
> {
> super();
> }
>
> protected override function updateDisplayList(unscaledWidth:Number,
> unscaledHeight:Number):void {
> super.updateDisplayList(unscaledWidth, unscaledHeight);
> //this.alpha = 0.5; //Uncomment to see the line below.
> this.graphics.lineStyle(5, 0xFF0000);
> this.graphics.moveTo(0, 0)
> this.graphics.lineTo(20, 20);
> }
>
> }
>
>
>
>
>
>
>
> --
> Flexcoders Mailing List
> FAQ:
http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
> Search Archives:
> http://www.mail-archive.com/flexcoders%40yahoogroups.com
> Yahoo! Groups Links
>
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
SPONSORED LINKS
| Web site design development | Computer software development | Software design and development |
| Macromedia flex | Software development best practice |
YAHOO! GROUPS LINKS
- Visit your group "flexcoders" on the web.
- To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
- Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.

