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




Reply via email to