Hi Vijay, If you want to draw a line on top of the background of a canvas, you can draw it in a BorderSkin. Or, something like this works, usually by overriding createChildren():
var myComponent:UIComponent = new UIComponent(); var myShape:Shape = new Shape(); myShape.graphics.lineStyle(2); myShape.graphics.moveTo(0, 0); myShape.graphics.lineTo(100, 100); myComponent.addChild(myShape); myCanvas.addChild(myComponent); One of the component gurus will have to explain why you need to add a UIComponent for this to work. -TH --- In [email protected], "Vijay Ganesan" <[EMAIL PROTECTED]> wrote: > > > 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 >

