I'm trying to draw a line on a Canvas using the Graphic API as follows:

myCanvas.graphics.clear();
myCanvas.graphics.lineStyle(2);
myCanvas.graphics.moveTo(0,0);
myCanvas.graphics.lineTo(100,100);

This works fine as long as the Canvas does not have a backgroundColor
style property set. Once the backgroundColor property is set, my drawn
line is "behind the background color". If I change the backroundAlpha
to a value closer to 0, I can see my drawn line "through the background".

How can I draw my line on top of the background? I tried using a Shape
object to draw into and add the Shape object as a child to the Canvas
but get an exception:
TypeError: Error #1034: Type Coercion failed: cannot convert
flash.display::[EMAIL PROTECTED] to mx.core.IUIComponent.
I guess children of Canvas have to be IUIComponentS.

What is the best strategy for drawing on a Canvas with a backgroundColor?

Thanks
Vijay


Reply via email to